github.com/cloudwan/edgelq-sdk@v1.15.4/audit/resources/v1/activity_log/activity_log.pb.fieldpath.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 "fmt" 10 "reflect" 11 "strings" 12 "time" 13 14 "google.golang.org/grpc/codes" 15 "google.golang.org/grpc/status" 16 "google.golang.org/protobuf/encoding/protojson" 17 "google.golang.org/protobuf/proto" 18 "google.golang.org/protobuf/reflect/protoregistry" 19 20 gotenobject "github.com/cloudwan/goten-sdk/runtime/object" 21 "github.com/cloudwan/goten-sdk/runtime/strcase" 22 ) 23 24 // proto imports 25 import ( 26 common "github.com/cloudwan/edgelq-sdk/audit/resources/v1/common" 27 rpc "github.com/cloudwan/edgelq-sdk/common/rpc" 28 iam_organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1/organization" 29 iam_project "github.com/cloudwan/edgelq-sdk/iam/resources/v1/project" 30 meta_service "github.com/cloudwan/goten-sdk/meta-service/resources/v1/service" 31 anypb "google.golang.org/protobuf/types/known/anypb" 32 fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" 33 timestamppb "google.golang.org/protobuf/types/known/timestamppb" 34 ) 35 36 // ensure the imports are used 37 var ( 38 _ = new(json.Marshaler) 39 _ = new(fmt.Stringer) 40 _ = reflect.DeepEqual 41 _ = strings.Builder{} 42 _ = time.Second 43 44 _ = strcase.ToLowerCamel 45 _ = codes.NotFound 46 _ = status.Status{} 47 _ = protojson.UnmarshalOptions{} 48 _ = new(proto.Message) 49 _ = protoregistry.GlobalTypes 50 51 _ = new(gotenobject.FieldPath) 52 ) 53 54 // make sure we're using proto imports 55 var ( 56 _ = &common.Authentication{} 57 _ = &rpc.Status{} 58 _ = &iam_organization.Organization{} 59 _ = &iam_project.Project{} 60 _ = &anypb.Any{} 61 _ = &fieldmaskpb.FieldMask{} 62 _ = ×tamppb.Timestamp{} 63 _ = &meta_service.Service{} 64 ) 65 66 // FieldPath provides implementation to handle 67 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 68 type ActivityLog_FieldPath interface { 69 gotenobject.FieldPath 70 Selector() ActivityLog_FieldPathSelector 71 Get(source *ActivityLog) []interface{} 72 GetSingle(source *ActivityLog) (interface{}, bool) 73 ClearValue(item *ActivityLog) 74 75 // Those methods build corresponding ActivityLog_FieldPathValue 76 // (or array of values) and holds passed value. Panics if injected type is incorrect. 77 WithIValue(value interface{}) ActivityLog_FieldPathValue 78 WithIArrayOfValues(values interface{}) ActivityLog_FieldPathArrayOfValues 79 WithIArrayItemValue(value interface{}) ActivityLog_FieldPathArrayItemValue 80 } 81 82 type ActivityLog_FieldPathSelector int32 83 84 const ( 85 ActivityLog_FieldPathSelectorName ActivityLog_FieldPathSelector = 0 86 ActivityLog_FieldPathSelectorScope ActivityLog_FieldPathSelector = 1 87 ActivityLog_FieldPathSelectorRequestId ActivityLog_FieldPathSelector = 2 88 ActivityLog_FieldPathSelectorAuthentication ActivityLog_FieldPathSelector = 3 89 ActivityLog_FieldPathSelectorAuthorization ActivityLog_FieldPathSelector = 4 90 ActivityLog_FieldPathSelectorService ActivityLog_FieldPathSelector = 5 91 ActivityLog_FieldPathSelectorMethod ActivityLog_FieldPathSelector = 6 92 ActivityLog_FieldPathSelectorRequestMetadata ActivityLog_FieldPathSelector = 7 93 ActivityLog_FieldPathSelectorRequestRouting ActivityLog_FieldPathSelector = 8 94 ActivityLog_FieldPathSelectorResource ActivityLog_FieldPathSelector = 9 95 ActivityLog_FieldPathSelectorCategory ActivityLog_FieldPathSelector = 10 96 ActivityLog_FieldPathSelectorLabels ActivityLog_FieldPathSelector = 11 97 ActivityLog_FieldPathSelectorEvents ActivityLog_FieldPathSelector = 12 98 ) 99 100 func (s ActivityLog_FieldPathSelector) String() string { 101 switch s { 102 case ActivityLog_FieldPathSelectorName: 103 return "name" 104 case ActivityLog_FieldPathSelectorScope: 105 return "scope" 106 case ActivityLog_FieldPathSelectorRequestId: 107 return "request_id" 108 case ActivityLog_FieldPathSelectorAuthentication: 109 return "authentication" 110 case ActivityLog_FieldPathSelectorAuthorization: 111 return "authorization" 112 case ActivityLog_FieldPathSelectorService: 113 return "service" 114 case ActivityLog_FieldPathSelectorMethod: 115 return "method" 116 case ActivityLog_FieldPathSelectorRequestMetadata: 117 return "request_metadata" 118 case ActivityLog_FieldPathSelectorRequestRouting: 119 return "request_routing" 120 case ActivityLog_FieldPathSelectorResource: 121 return "resource" 122 case ActivityLog_FieldPathSelectorCategory: 123 return "category" 124 case ActivityLog_FieldPathSelectorLabels: 125 return "labels" 126 case ActivityLog_FieldPathSelectorEvents: 127 return "events" 128 default: 129 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", s)) 130 } 131 } 132 133 func BuildActivityLog_FieldPath(fp gotenobject.RawFieldPath) (ActivityLog_FieldPath, error) { 134 if len(fp) == 0 { 135 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog") 136 } 137 if len(fp) == 1 { 138 switch fp[0] { 139 case "name": 140 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorName}, nil 141 case "scope": 142 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorScope}, nil 143 case "request_id", "requestId", "request-id": 144 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorRequestId}, nil 145 case "authentication": 146 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorAuthentication}, nil 147 case "authorization": 148 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorAuthorization}, nil 149 case "service": 150 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorService}, nil 151 case "method": 152 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorMethod}, nil 153 case "request_metadata", "requestMetadata", "request-metadata": 154 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorRequestMetadata}, nil 155 case "request_routing", "requestRouting", "request-routing": 156 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorRequestRouting}, nil 157 case "resource": 158 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorResource}, nil 159 case "category": 160 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorCategory}, nil 161 case "labels": 162 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorLabels}, nil 163 case "events": 164 return &ActivityLog_FieldTerminalPath{selector: ActivityLog_FieldPathSelectorEvents}, nil 165 } 166 } else { 167 switch fp[0] { 168 case "authentication": 169 if subpath, err := common.BuildAuthentication_FieldPath(fp[1:]); err != nil { 170 return nil, err 171 } else { 172 return &ActivityLog_FieldSubPath{selector: ActivityLog_FieldPathSelectorAuthentication, subPath: subpath}, nil 173 } 174 case "authorization": 175 if subpath, err := common.BuildAuthorization_FieldPath(fp[1:]); err != nil { 176 return nil, err 177 } else { 178 return &ActivityLog_FieldSubPath{selector: ActivityLog_FieldPathSelectorAuthorization, subPath: subpath}, nil 179 } 180 case "service": 181 if subpath, err := common.BuildServiceData_FieldPath(fp[1:]); err != nil { 182 return nil, err 183 } else { 184 return &ActivityLog_FieldSubPath{selector: ActivityLog_FieldPathSelectorService, subPath: subpath}, nil 185 } 186 case "method": 187 if subpath, err := BuildActivityLogMethod_FieldPath(fp[1:]); err != nil { 188 return nil, err 189 } else { 190 return &ActivityLog_FieldSubPath{selector: ActivityLog_FieldPathSelectorMethod, subPath: subpath}, nil 191 } 192 case "request_metadata", "requestMetadata", "request-metadata": 193 if subpath, err := BuildActivityLogRequestMetadata_FieldPath(fp[1:]); err != nil { 194 return nil, err 195 } else { 196 return &ActivityLog_FieldSubPath{selector: ActivityLog_FieldPathSelectorRequestMetadata, subPath: subpath}, nil 197 } 198 case "request_routing", "requestRouting", "request-routing": 199 if subpath, err := BuildActivityLogRequestRouting_FieldPath(fp[1:]); err != nil { 200 return nil, err 201 } else { 202 return &ActivityLog_FieldSubPath{selector: ActivityLog_FieldPathSelectorRequestRouting, subPath: subpath}, nil 203 } 204 case "resource": 205 if subpath, err := BuildActivityLogResource_FieldPath(fp[1:]); err != nil { 206 return nil, err 207 } else { 208 return &ActivityLog_FieldSubPath{selector: ActivityLog_FieldPathSelectorResource, subPath: subpath}, nil 209 } 210 case "events": 211 if subpath, err := BuildActivityLogEvent_FieldPath(fp[1:]); err != nil { 212 return nil, err 213 } else { 214 return &ActivityLog_FieldSubPath{selector: ActivityLog_FieldPathSelectorEvents, subPath: subpath}, nil 215 } 216 case "labels": 217 if len(fp) > 2 { 218 return nil, status.Errorf(codes.InvalidArgument, "sub path for maps ('%s') are not supported (object ActivityLog)", fp) 219 } 220 return &ActivityLog_FieldPathMap{selector: ActivityLog_FieldPathSelectorLabels, key: fp[1]}, nil 221 } 222 } 223 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog", fp) 224 } 225 226 func ParseActivityLog_FieldPath(rawField string) (ActivityLog_FieldPath, error) { 227 fp, err := gotenobject.ParseRawFieldPath(rawField) 228 if err != nil { 229 return nil, err 230 } 231 return BuildActivityLog_FieldPath(fp) 232 } 233 234 func MustParseActivityLog_FieldPath(rawField string) ActivityLog_FieldPath { 235 fp, err := ParseActivityLog_FieldPath(rawField) 236 if err != nil { 237 panic(err) 238 } 239 return fp 240 } 241 242 type ActivityLog_FieldTerminalPath struct { 243 selector ActivityLog_FieldPathSelector 244 } 245 246 var _ ActivityLog_FieldPath = (*ActivityLog_FieldTerminalPath)(nil) 247 248 func (fp *ActivityLog_FieldTerminalPath) Selector() ActivityLog_FieldPathSelector { 249 return fp.selector 250 } 251 252 // String returns path representation in proto convention 253 func (fp *ActivityLog_FieldTerminalPath) String() string { 254 return fp.selector.String() 255 } 256 257 // JSONString returns path representation is JSON convention 258 func (fp *ActivityLog_FieldTerminalPath) JSONString() string { 259 return strcase.ToLowerCamel(fp.String()) 260 } 261 262 // Get returns all values pointed by specific field from source ActivityLog 263 func (fp *ActivityLog_FieldTerminalPath) Get(source *ActivityLog) (values []interface{}) { 264 if source != nil { 265 switch fp.selector { 266 case ActivityLog_FieldPathSelectorName: 267 if source.Name != nil { 268 values = append(values, source.Name) 269 } 270 case ActivityLog_FieldPathSelectorScope: 271 values = append(values, source.Scope) 272 case ActivityLog_FieldPathSelectorRequestId: 273 values = append(values, source.RequestId) 274 case ActivityLog_FieldPathSelectorAuthentication: 275 if source.Authentication != nil { 276 values = append(values, source.Authentication) 277 } 278 case ActivityLog_FieldPathSelectorAuthorization: 279 if source.Authorization != nil { 280 values = append(values, source.Authorization) 281 } 282 case ActivityLog_FieldPathSelectorService: 283 if source.Service != nil { 284 values = append(values, source.Service) 285 } 286 case ActivityLog_FieldPathSelectorMethod: 287 if source.Method != nil { 288 values = append(values, source.Method) 289 } 290 case ActivityLog_FieldPathSelectorRequestMetadata: 291 if source.RequestMetadata != nil { 292 values = append(values, source.RequestMetadata) 293 } 294 case ActivityLog_FieldPathSelectorRequestRouting: 295 if source.RequestRouting != nil { 296 values = append(values, source.RequestRouting) 297 } 298 case ActivityLog_FieldPathSelectorResource: 299 if source.Resource != nil { 300 values = append(values, source.Resource) 301 } 302 case ActivityLog_FieldPathSelectorCategory: 303 values = append(values, source.Category) 304 case ActivityLog_FieldPathSelectorLabels: 305 values = append(values, source.Labels) 306 case ActivityLog_FieldPathSelectorEvents: 307 for _, value := range source.GetEvents() { 308 values = append(values, value) 309 } 310 default: 311 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fp.selector)) 312 } 313 } 314 return 315 } 316 317 func (fp *ActivityLog_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 318 return fp.Get(source.(*ActivityLog)) 319 } 320 321 // GetSingle returns value pointed by specific field of from source ActivityLog 322 func (fp *ActivityLog_FieldTerminalPath) GetSingle(source *ActivityLog) (interface{}, bool) { 323 switch fp.selector { 324 case ActivityLog_FieldPathSelectorName: 325 res := source.GetName() 326 return res, res != nil 327 case ActivityLog_FieldPathSelectorScope: 328 return source.GetScope(), source != nil 329 case ActivityLog_FieldPathSelectorRequestId: 330 return source.GetRequestId(), source != nil 331 case ActivityLog_FieldPathSelectorAuthentication: 332 res := source.GetAuthentication() 333 return res, res != nil 334 case ActivityLog_FieldPathSelectorAuthorization: 335 res := source.GetAuthorization() 336 return res, res != nil 337 case ActivityLog_FieldPathSelectorService: 338 res := source.GetService() 339 return res, res != nil 340 case ActivityLog_FieldPathSelectorMethod: 341 res := source.GetMethod() 342 return res, res != nil 343 case ActivityLog_FieldPathSelectorRequestMetadata: 344 res := source.GetRequestMetadata() 345 return res, res != nil 346 case ActivityLog_FieldPathSelectorRequestRouting: 347 res := source.GetRequestRouting() 348 return res, res != nil 349 case ActivityLog_FieldPathSelectorResource: 350 res := source.GetResource() 351 return res, res != nil 352 case ActivityLog_FieldPathSelectorCategory: 353 return source.GetCategory(), source != nil 354 case ActivityLog_FieldPathSelectorLabels: 355 res := source.GetLabels() 356 return res, res != nil 357 case ActivityLog_FieldPathSelectorEvents: 358 res := source.GetEvents() 359 return res, res != nil 360 default: 361 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fp.selector)) 362 } 363 } 364 365 func (fp *ActivityLog_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 366 return fp.GetSingle(source.(*ActivityLog)) 367 } 368 369 // GetDefault returns a default value of the field type 370 func (fp *ActivityLog_FieldTerminalPath) GetDefault() interface{} { 371 switch fp.selector { 372 case ActivityLog_FieldPathSelectorName: 373 return (*Name)(nil) 374 case ActivityLog_FieldPathSelectorScope: 375 return "" 376 case ActivityLog_FieldPathSelectorRequestId: 377 return uint64(0) 378 case ActivityLog_FieldPathSelectorAuthentication: 379 return (*common.Authentication)(nil) 380 case ActivityLog_FieldPathSelectorAuthorization: 381 return (*common.Authorization)(nil) 382 case ActivityLog_FieldPathSelectorService: 383 return (*common.ServiceData)(nil) 384 case ActivityLog_FieldPathSelectorMethod: 385 return (*ActivityLog_Method)(nil) 386 case ActivityLog_FieldPathSelectorRequestMetadata: 387 return (*ActivityLog_RequestMetadata)(nil) 388 case ActivityLog_FieldPathSelectorRequestRouting: 389 return (*ActivityLog_RequestRouting)(nil) 390 case ActivityLog_FieldPathSelectorResource: 391 return (*ActivityLog_Resource)(nil) 392 case ActivityLog_FieldPathSelectorCategory: 393 return ActivityLog_Undefined 394 case ActivityLog_FieldPathSelectorLabels: 395 return (map[string]string)(nil) 396 case ActivityLog_FieldPathSelectorEvents: 397 return ([]*ActivityLog_Event)(nil) 398 default: 399 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fp.selector)) 400 } 401 } 402 403 func (fp *ActivityLog_FieldTerminalPath) ClearValue(item *ActivityLog) { 404 if item != nil { 405 switch fp.selector { 406 case ActivityLog_FieldPathSelectorName: 407 item.Name = nil 408 case ActivityLog_FieldPathSelectorScope: 409 item.Scope = "" 410 case ActivityLog_FieldPathSelectorRequestId: 411 item.RequestId = uint64(0) 412 case ActivityLog_FieldPathSelectorAuthentication: 413 item.Authentication = nil 414 case ActivityLog_FieldPathSelectorAuthorization: 415 item.Authorization = nil 416 case ActivityLog_FieldPathSelectorService: 417 item.Service = nil 418 case ActivityLog_FieldPathSelectorMethod: 419 item.Method = nil 420 case ActivityLog_FieldPathSelectorRequestMetadata: 421 item.RequestMetadata = nil 422 case ActivityLog_FieldPathSelectorRequestRouting: 423 item.RequestRouting = nil 424 case ActivityLog_FieldPathSelectorResource: 425 item.Resource = nil 426 case ActivityLog_FieldPathSelectorCategory: 427 item.Category = ActivityLog_Undefined 428 case ActivityLog_FieldPathSelectorLabels: 429 item.Labels = nil 430 case ActivityLog_FieldPathSelectorEvents: 431 item.Events = nil 432 default: 433 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fp.selector)) 434 } 435 } 436 } 437 438 func (fp *ActivityLog_FieldTerminalPath) ClearValueRaw(item proto.Message) { 439 fp.ClearValue(item.(*ActivityLog)) 440 } 441 442 // IsLeaf - whether field path is holds simple value 443 func (fp *ActivityLog_FieldTerminalPath) IsLeaf() bool { 444 return fp.selector == ActivityLog_FieldPathSelectorName || 445 fp.selector == ActivityLog_FieldPathSelectorScope || 446 fp.selector == ActivityLog_FieldPathSelectorRequestId || 447 fp.selector == ActivityLog_FieldPathSelectorCategory || 448 fp.selector == ActivityLog_FieldPathSelectorLabels 449 } 450 451 func (fp *ActivityLog_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 452 return []gotenobject.FieldPath{fp} 453 } 454 455 func (fp *ActivityLog_FieldTerminalPath) WithIValue(value interface{}) ActivityLog_FieldPathValue { 456 switch fp.selector { 457 case ActivityLog_FieldPathSelectorName: 458 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(*Name)} 459 case ActivityLog_FieldPathSelectorScope: 460 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(string)} 461 case ActivityLog_FieldPathSelectorRequestId: 462 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(uint64)} 463 case ActivityLog_FieldPathSelectorAuthentication: 464 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(*common.Authentication)} 465 case ActivityLog_FieldPathSelectorAuthorization: 466 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(*common.Authorization)} 467 case ActivityLog_FieldPathSelectorService: 468 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(*common.ServiceData)} 469 case ActivityLog_FieldPathSelectorMethod: 470 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(*ActivityLog_Method)} 471 case ActivityLog_FieldPathSelectorRequestMetadata: 472 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(*ActivityLog_RequestMetadata)} 473 case ActivityLog_FieldPathSelectorRequestRouting: 474 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(*ActivityLog_RequestRouting)} 475 case ActivityLog_FieldPathSelectorResource: 476 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(*ActivityLog_Resource)} 477 case ActivityLog_FieldPathSelectorCategory: 478 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(ActivityLog_Category)} 479 case ActivityLog_FieldPathSelectorLabels: 480 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.(map[string]string)} 481 case ActivityLog_FieldPathSelectorEvents: 482 return &ActivityLog_FieldTerminalPathValue{ActivityLog_FieldTerminalPath: *fp, value: value.([]*ActivityLog_Event)} 483 default: 484 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fp.selector)) 485 } 486 } 487 488 func (fp *ActivityLog_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 489 return fp.WithIValue(value) 490 } 491 492 func (fp *ActivityLog_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLog_FieldPathArrayOfValues { 493 fpaov := &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp} 494 switch fp.selector { 495 case ActivityLog_FieldPathSelectorName: 496 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]*Name)} 497 case ActivityLog_FieldPathSelectorScope: 498 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]string)} 499 case ActivityLog_FieldPathSelectorRequestId: 500 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]uint64)} 501 case ActivityLog_FieldPathSelectorAuthentication: 502 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]*common.Authentication)} 503 case ActivityLog_FieldPathSelectorAuthorization: 504 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]*common.Authorization)} 505 case ActivityLog_FieldPathSelectorService: 506 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]*common.ServiceData)} 507 case ActivityLog_FieldPathSelectorMethod: 508 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]*ActivityLog_Method)} 509 case ActivityLog_FieldPathSelectorRequestMetadata: 510 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]*ActivityLog_RequestMetadata)} 511 case ActivityLog_FieldPathSelectorRequestRouting: 512 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]*ActivityLog_RequestRouting)} 513 case ActivityLog_FieldPathSelectorResource: 514 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]*ActivityLog_Resource)} 515 case ActivityLog_FieldPathSelectorCategory: 516 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]ActivityLog_Category)} 517 case ActivityLog_FieldPathSelectorLabels: 518 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([]map[string]string)} 519 case ActivityLog_FieldPathSelectorEvents: 520 return &ActivityLog_FieldTerminalPathArrayOfValues{ActivityLog_FieldTerminalPath: *fp, values: values.([][]*ActivityLog_Event)} 521 default: 522 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fp.selector)) 523 } 524 return fpaov 525 } 526 527 func (fp *ActivityLog_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 528 return fp.WithIArrayOfValues(values) 529 } 530 531 func (fp *ActivityLog_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLog_FieldPathArrayItemValue { 532 switch fp.selector { 533 case ActivityLog_FieldPathSelectorEvents: 534 return &ActivityLog_FieldTerminalPathArrayItemValue{ActivityLog_FieldTerminalPath: *fp, value: value.(*ActivityLog_Event)} 535 default: 536 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fp.selector)) 537 } 538 } 539 540 func (fp *ActivityLog_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 541 return fp.WithIArrayItemValue(value) 542 } 543 544 // FieldPath for map type with additional Key information 545 type ActivityLog_FieldPathMap struct { 546 key string 547 selector ActivityLog_FieldPathSelector 548 } 549 550 var _ ActivityLog_FieldPath = (*ActivityLog_FieldPathMap)(nil) 551 552 func (fpm *ActivityLog_FieldPathMap) Selector() ActivityLog_FieldPathSelector { 553 return fpm.selector 554 } 555 556 func (fpm *ActivityLog_FieldPathMap) Key() string { 557 return fpm.key 558 } 559 560 // String returns path representation in proto convention 561 func (fpm *ActivityLog_FieldPathMap) String() string { 562 return fpm.selector.String() + "." + fpm.key 563 } 564 565 // JSONString returns path representation is JSON convention. Note that map keys are not transformed 566 func (fpm *ActivityLog_FieldPathMap) JSONString() string { 567 return strcase.ToLowerCamel(fpm.selector.String()) + "." + fpm.key 568 } 569 570 // Get returns all values pointed by selected field map key from source ActivityLog 571 func (fpm *ActivityLog_FieldPathMap) Get(source *ActivityLog) (values []interface{}) { 572 switch fpm.selector { 573 case ActivityLog_FieldPathSelectorLabels: 574 if value, ok := source.GetLabels()[fpm.key]; ok { 575 values = append(values, value) 576 } 577 default: 578 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpm.selector)) 579 } 580 return 581 } 582 583 func (fpm *ActivityLog_FieldPathMap) GetRaw(source proto.Message) []interface{} { 584 return fpm.Get(source.(*ActivityLog)) 585 } 586 587 // GetSingle returns value by selected field map key from source ActivityLog 588 func (fpm *ActivityLog_FieldPathMap) GetSingle(source *ActivityLog) (interface{}, bool) { 589 switch fpm.selector { 590 case ActivityLog_FieldPathSelectorLabels: 591 res, ok := source.GetLabels()[fpm.key] 592 return res, ok 593 default: 594 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpm.selector)) 595 } 596 } 597 598 func (fpm *ActivityLog_FieldPathMap) GetSingleRaw(source proto.Message) (interface{}, bool) { 599 return fpm.GetSingle(source.(*ActivityLog)) 600 } 601 602 // GetDefault returns a default value of the field type 603 func (fpm *ActivityLog_FieldPathMap) GetDefault() interface{} { 604 switch fpm.selector { 605 case ActivityLog_FieldPathSelectorLabels: 606 var v string 607 return v 608 default: 609 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpm.selector)) 610 } 611 } 612 613 func (fpm *ActivityLog_FieldPathMap) ClearValue(item *ActivityLog) { 614 if item != nil { 615 switch fpm.selector { 616 case ActivityLog_FieldPathSelectorLabels: 617 delete(item.Labels, fpm.key) 618 default: 619 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpm.selector)) 620 } 621 } 622 } 623 624 func (fpm *ActivityLog_FieldPathMap) ClearValueRaw(item proto.Message) { 625 fpm.ClearValue(item.(*ActivityLog)) 626 } 627 628 // IsLeaf - whether field path is holds simple value 629 func (fpm *ActivityLog_FieldPathMap) IsLeaf() bool { 630 switch fpm.selector { 631 case ActivityLog_FieldPathSelectorLabels: 632 return true 633 default: 634 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpm.selector)) 635 } 636 } 637 638 func (fpm *ActivityLog_FieldPathMap) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 639 return []gotenobject.FieldPath{fpm} 640 } 641 642 func (fpm *ActivityLog_FieldPathMap) WithIValue(value interface{}) ActivityLog_FieldPathValue { 643 switch fpm.selector { 644 case ActivityLog_FieldPathSelectorLabels: 645 return &ActivityLog_FieldPathMapValue{ActivityLog_FieldPathMap: *fpm, value: value.(string)} 646 default: 647 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpm.selector)) 648 } 649 } 650 651 func (fpm *ActivityLog_FieldPathMap) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 652 return fpm.WithIValue(value) 653 } 654 655 func (fpm *ActivityLog_FieldPathMap) WithIArrayOfValues(values interface{}) ActivityLog_FieldPathArrayOfValues { 656 switch fpm.selector { 657 case ActivityLog_FieldPathSelectorLabels: 658 return &ActivityLog_FieldPathMapArrayOfValues{ActivityLog_FieldPathMap: *fpm, values: values.([]string)} 659 default: 660 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpm.selector)) 661 } 662 } 663 664 func (fpm *ActivityLog_FieldPathMap) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 665 return fpm.WithIArrayOfValues(values) 666 } 667 668 func (fpm *ActivityLog_FieldPathMap) WithIArrayItemValue(value interface{}) ActivityLog_FieldPathArrayItemValue { 669 panic("Cannot create array item value from map fieldpath") 670 } 671 672 func (fpm *ActivityLog_FieldPathMap) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 673 return fpm.WithIArrayItemValue(value) 674 } 675 676 type ActivityLog_FieldSubPath struct { 677 selector ActivityLog_FieldPathSelector 678 subPath gotenobject.FieldPath 679 } 680 681 var _ ActivityLog_FieldPath = (*ActivityLog_FieldSubPath)(nil) 682 683 func (fps *ActivityLog_FieldSubPath) Selector() ActivityLog_FieldPathSelector { 684 return fps.selector 685 } 686 func (fps *ActivityLog_FieldSubPath) AsAuthenticationSubPath() (common.Authentication_FieldPath, bool) { 687 res, ok := fps.subPath.(common.Authentication_FieldPath) 688 return res, ok 689 } 690 func (fps *ActivityLog_FieldSubPath) AsAuthorizationSubPath() (common.Authorization_FieldPath, bool) { 691 res, ok := fps.subPath.(common.Authorization_FieldPath) 692 return res, ok 693 } 694 func (fps *ActivityLog_FieldSubPath) AsServiceSubPath() (common.ServiceData_FieldPath, bool) { 695 res, ok := fps.subPath.(common.ServiceData_FieldPath) 696 return res, ok 697 } 698 func (fps *ActivityLog_FieldSubPath) AsMethodSubPath() (ActivityLogMethod_FieldPath, bool) { 699 res, ok := fps.subPath.(ActivityLogMethod_FieldPath) 700 return res, ok 701 } 702 func (fps *ActivityLog_FieldSubPath) AsRequestMetadataSubPath() (ActivityLogRequestMetadata_FieldPath, bool) { 703 res, ok := fps.subPath.(ActivityLogRequestMetadata_FieldPath) 704 return res, ok 705 } 706 func (fps *ActivityLog_FieldSubPath) AsRequestRoutingSubPath() (ActivityLogRequestRouting_FieldPath, bool) { 707 res, ok := fps.subPath.(ActivityLogRequestRouting_FieldPath) 708 return res, ok 709 } 710 func (fps *ActivityLog_FieldSubPath) AsResourceSubPath() (ActivityLogResource_FieldPath, bool) { 711 res, ok := fps.subPath.(ActivityLogResource_FieldPath) 712 return res, ok 713 } 714 func (fps *ActivityLog_FieldSubPath) AsEventsSubPath() (ActivityLogEvent_FieldPath, bool) { 715 res, ok := fps.subPath.(ActivityLogEvent_FieldPath) 716 return res, ok 717 } 718 719 // String returns path representation in proto convention 720 func (fps *ActivityLog_FieldSubPath) String() string { 721 return fps.selector.String() + "." + fps.subPath.String() 722 } 723 724 // JSONString returns path representation is JSON convention 725 func (fps *ActivityLog_FieldSubPath) JSONString() string { 726 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 727 } 728 729 // Get returns all values pointed by selected field from source ActivityLog 730 func (fps *ActivityLog_FieldSubPath) Get(source *ActivityLog) (values []interface{}) { 731 switch fps.selector { 732 case ActivityLog_FieldPathSelectorAuthentication: 733 values = append(values, fps.subPath.GetRaw(source.GetAuthentication())...) 734 case ActivityLog_FieldPathSelectorAuthorization: 735 values = append(values, fps.subPath.GetRaw(source.GetAuthorization())...) 736 case ActivityLog_FieldPathSelectorService: 737 values = append(values, fps.subPath.GetRaw(source.GetService())...) 738 case ActivityLog_FieldPathSelectorMethod: 739 values = append(values, fps.subPath.GetRaw(source.GetMethod())...) 740 case ActivityLog_FieldPathSelectorRequestMetadata: 741 values = append(values, fps.subPath.GetRaw(source.GetRequestMetadata())...) 742 case ActivityLog_FieldPathSelectorRequestRouting: 743 values = append(values, fps.subPath.GetRaw(source.GetRequestRouting())...) 744 case ActivityLog_FieldPathSelectorResource: 745 values = append(values, fps.subPath.GetRaw(source.GetResource())...) 746 case ActivityLog_FieldPathSelectorEvents: 747 for _, item := range source.GetEvents() { 748 values = append(values, fps.subPath.GetRaw(item)...) 749 } 750 default: 751 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fps.selector)) 752 } 753 return 754 } 755 756 func (fps *ActivityLog_FieldSubPath) GetRaw(source proto.Message) []interface{} { 757 return fps.Get(source.(*ActivityLog)) 758 } 759 760 // GetSingle returns value of selected field from source ActivityLog 761 func (fps *ActivityLog_FieldSubPath) GetSingle(source *ActivityLog) (interface{}, bool) { 762 switch fps.selector { 763 case ActivityLog_FieldPathSelectorAuthentication: 764 if source.GetAuthentication() == nil { 765 return nil, false 766 } 767 return fps.subPath.GetSingleRaw(source.GetAuthentication()) 768 case ActivityLog_FieldPathSelectorAuthorization: 769 if source.GetAuthorization() == nil { 770 return nil, false 771 } 772 return fps.subPath.GetSingleRaw(source.GetAuthorization()) 773 case ActivityLog_FieldPathSelectorService: 774 if source.GetService() == nil { 775 return nil, false 776 } 777 return fps.subPath.GetSingleRaw(source.GetService()) 778 case ActivityLog_FieldPathSelectorMethod: 779 if source.GetMethod() == nil { 780 return nil, false 781 } 782 return fps.subPath.GetSingleRaw(source.GetMethod()) 783 case ActivityLog_FieldPathSelectorRequestMetadata: 784 if source.GetRequestMetadata() == nil { 785 return nil, false 786 } 787 return fps.subPath.GetSingleRaw(source.GetRequestMetadata()) 788 case ActivityLog_FieldPathSelectorRequestRouting: 789 if source.GetRequestRouting() == nil { 790 return nil, false 791 } 792 return fps.subPath.GetSingleRaw(source.GetRequestRouting()) 793 case ActivityLog_FieldPathSelectorResource: 794 if source.GetResource() == nil { 795 return nil, false 796 } 797 return fps.subPath.GetSingleRaw(source.GetResource()) 798 case ActivityLog_FieldPathSelectorEvents: 799 if len(source.GetEvents()) == 0 { 800 return nil, false 801 } 802 return fps.subPath.GetSingleRaw(source.GetEvents()[0]) 803 default: 804 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fps.selector)) 805 } 806 } 807 808 func (fps *ActivityLog_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 809 return fps.GetSingle(source.(*ActivityLog)) 810 } 811 812 // GetDefault returns a default value of the field type 813 func (fps *ActivityLog_FieldSubPath) GetDefault() interface{} { 814 return fps.subPath.GetDefault() 815 } 816 817 func (fps *ActivityLog_FieldSubPath) ClearValue(item *ActivityLog) { 818 if item != nil { 819 switch fps.selector { 820 case ActivityLog_FieldPathSelectorAuthentication: 821 fps.subPath.ClearValueRaw(item.Authentication) 822 case ActivityLog_FieldPathSelectorAuthorization: 823 fps.subPath.ClearValueRaw(item.Authorization) 824 case ActivityLog_FieldPathSelectorService: 825 fps.subPath.ClearValueRaw(item.Service) 826 case ActivityLog_FieldPathSelectorMethod: 827 fps.subPath.ClearValueRaw(item.Method) 828 case ActivityLog_FieldPathSelectorRequestMetadata: 829 fps.subPath.ClearValueRaw(item.RequestMetadata) 830 case ActivityLog_FieldPathSelectorRequestRouting: 831 fps.subPath.ClearValueRaw(item.RequestRouting) 832 case ActivityLog_FieldPathSelectorResource: 833 fps.subPath.ClearValueRaw(item.Resource) 834 case ActivityLog_FieldPathSelectorEvents: 835 for _, subItem := range item.Events { 836 fps.subPath.ClearValueRaw(subItem) 837 } 838 default: 839 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fps.selector)) 840 } 841 } 842 } 843 844 func (fps *ActivityLog_FieldSubPath) ClearValueRaw(item proto.Message) { 845 fps.ClearValue(item.(*ActivityLog)) 846 } 847 848 // IsLeaf - whether field path is holds simple value 849 func (fps *ActivityLog_FieldSubPath) IsLeaf() bool { 850 return fps.subPath.IsLeaf() 851 } 852 853 func (fps *ActivityLog_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 854 iPaths := []gotenobject.FieldPath{&ActivityLog_FieldTerminalPath{selector: fps.selector}} 855 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 856 return iPaths 857 } 858 859 func (fps *ActivityLog_FieldSubPath) WithIValue(value interface{}) ActivityLog_FieldPathValue { 860 return &ActivityLog_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 861 } 862 863 func (fps *ActivityLog_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 864 return fps.WithIValue(value) 865 } 866 867 func (fps *ActivityLog_FieldSubPath) WithIArrayOfValues(values interface{}) ActivityLog_FieldPathArrayOfValues { 868 return &ActivityLog_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 869 } 870 871 func (fps *ActivityLog_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 872 return fps.WithIArrayOfValues(values) 873 } 874 875 func (fps *ActivityLog_FieldSubPath) WithIArrayItemValue(value interface{}) ActivityLog_FieldPathArrayItemValue { 876 return &ActivityLog_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 877 } 878 879 func (fps *ActivityLog_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 880 return fps.WithIArrayItemValue(value) 881 } 882 883 // ActivityLog_FieldPathValue allows storing values for ActivityLog fields according to their type 884 type ActivityLog_FieldPathValue interface { 885 ActivityLog_FieldPath 886 gotenobject.FieldPathValue 887 SetTo(target **ActivityLog) 888 CompareWith(*ActivityLog) (cmp int, comparable bool) 889 } 890 891 func ParseActivityLog_FieldPathValue(pathStr, valueStr string) (ActivityLog_FieldPathValue, error) { 892 fp, err := ParseActivityLog_FieldPath(pathStr) 893 if err != nil { 894 return nil, err 895 } 896 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 897 if err != nil { 898 return nil, status.Errorf(codes.InvalidArgument, "error parsing ActivityLog field path value from %s: %v", valueStr, err) 899 } 900 return fpv.(ActivityLog_FieldPathValue), nil 901 } 902 903 func MustParseActivityLog_FieldPathValue(pathStr, valueStr string) ActivityLog_FieldPathValue { 904 fpv, err := ParseActivityLog_FieldPathValue(pathStr, valueStr) 905 if err != nil { 906 panic(err) 907 } 908 return fpv 909 } 910 911 type ActivityLog_FieldTerminalPathValue struct { 912 ActivityLog_FieldTerminalPath 913 value interface{} 914 } 915 916 var _ ActivityLog_FieldPathValue = (*ActivityLog_FieldTerminalPathValue)(nil) 917 918 // GetRawValue returns raw value stored under selected path for 'ActivityLog' as interface{} 919 func (fpv *ActivityLog_FieldTerminalPathValue) GetRawValue() interface{} { 920 return fpv.value 921 } 922 func (fpv *ActivityLog_FieldTerminalPathValue) AsNameValue() (*Name, bool) { 923 res, ok := fpv.value.(*Name) 924 return res, ok 925 } 926 func (fpv *ActivityLog_FieldTerminalPathValue) AsScopeValue() (string, bool) { 927 res, ok := fpv.value.(string) 928 return res, ok 929 } 930 func (fpv *ActivityLog_FieldTerminalPathValue) AsRequestIdValue() (uint64, bool) { 931 res, ok := fpv.value.(uint64) 932 return res, ok 933 } 934 func (fpv *ActivityLog_FieldTerminalPathValue) AsAuthenticationValue() (*common.Authentication, bool) { 935 res, ok := fpv.value.(*common.Authentication) 936 return res, ok 937 } 938 func (fpv *ActivityLog_FieldTerminalPathValue) AsAuthorizationValue() (*common.Authorization, bool) { 939 res, ok := fpv.value.(*common.Authorization) 940 return res, ok 941 } 942 func (fpv *ActivityLog_FieldTerminalPathValue) AsServiceValue() (*common.ServiceData, bool) { 943 res, ok := fpv.value.(*common.ServiceData) 944 return res, ok 945 } 946 func (fpv *ActivityLog_FieldTerminalPathValue) AsMethodValue() (*ActivityLog_Method, bool) { 947 res, ok := fpv.value.(*ActivityLog_Method) 948 return res, ok 949 } 950 func (fpv *ActivityLog_FieldTerminalPathValue) AsRequestMetadataValue() (*ActivityLog_RequestMetadata, bool) { 951 res, ok := fpv.value.(*ActivityLog_RequestMetadata) 952 return res, ok 953 } 954 func (fpv *ActivityLog_FieldTerminalPathValue) AsRequestRoutingValue() (*ActivityLog_RequestRouting, bool) { 955 res, ok := fpv.value.(*ActivityLog_RequestRouting) 956 return res, ok 957 } 958 func (fpv *ActivityLog_FieldTerminalPathValue) AsResourceValue() (*ActivityLog_Resource, bool) { 959 res, ok := fpv.value.(*ActivityLog_Resource) 960 return res, ok 961 } 962 func (fpv *ActivityLog_FieldTerminalPathValue) AsCategoryValue() (ActivityLog_Category, bool) { 963 res, ok := fpv.value.(ActivityLog_Category) 964 return res, ok 965 } 966 func (fpv *ActivityLog_FieldTerminalPathValue) AsLabelsValue() (map[string]string, bool) { 967 res, ok := fpv.value.(map[string]string) 968 return res, ok 969 } 970 func (fpv *ActivityLog_FieldTerminalPathValue) AsEventsValue() ([]*ActivityLog_Event, bool) { 971 res, ok := fpv.value.([]*ActivityLog_Event) 972 return res, ok 973 } 974 975 // SetTo stores value for selected field for object ActivityLog 976 func (fpv *ActivityLog_FieldTerminalPathValue) SetTo(target **ActivityLog) { 977 if *target == nil { 978 *target = new(ActivityLog) 979 } 980 switch fpv.selector { 981 case ActivityLog_FieldPathSelectorName: 982 (*target).Name = fpv.value.(*Name) 983 case ActivityLog_FieldPathSelectorScope: 984 (*target).Scope = fpv.value.(string) 985 case ActivityLog_FieldPathSelectorRequestId: 986 (*target).RequestId = fpv.value.(uint64) 987 case ActivityLog_FieldPathSelectorAuthentication: 988 (*target).Authentication = fpv.value.(*common.Authentication) 989 case ActivityLog_FieldPathSelectorAuthorization: 990 (*target).Authorization = fpv.value.(*common.Authorization) 991 case ActivityLog_FieldPathSelectorService: 992 (*target).Service = fpv.value.(*common.ServiceData) 993 case ActivityLog_FieldPathSelectorMethod: 994 (*target).Method = fpv.value.(*ActivityLog_Method) 995 case ActivityLog_FieldPathSelectorRequestMetadata: 996 (*target).RequestMetadata = fpv.value.(*ActivityLog_RequestMetadata) 997 case ActivityLog_FieldPathSelectorRequestRouting: 998 (*target).RequestRouting = fpv.value.(*ActivityLog_RequestRouting) 999 case ActivityLog_FieldPathSelectorResource: 1000 (*target).Resource = fpv.value.(*ActivityLog_Resource) 1001 case ActivityLog_FieldPathSelectorCategory: 1002 (*target).Category = fpv.value.(ActivityLog_Category) 1003 case ActivityLog_FieldPathSelectorLabels: 1004 (*target).Labels = fpv.value.(map[string]string) 1005 case ActivityLog_FieldPathSelectorEvents: 1006 (*target).Events = fpv.value.([]*ActivityLog_Event) 1007 default: 1008 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpv.selector)) 1009 } 1010 } 1011 1012 func (fpv *ActivityLog_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1013 typedObject := target.(*ActivityLog) 1014 fpv.SetTo(&typedObject) 1015 } 1016 1017 // CompareWith compares value in the 'ActivityLog_FieldTerminalPathValue' with the value under path in 'ActivityLog'. 1018 func (fpv *ActivityLog_FieldTerminalPathValue) CompareWith(source *ActivityLog) (int, bool) { 1019 switch fpv.selector { 1020 case ActivityLog_FieldPathSelectorName: 1021 leftValue := fpv.value.(*Name) 1022 rightValue := source.GetName() 1023 if leftValue == nil { 1024 if rightValue != nil { 1025 return -1, true 1026 } 1027 return 0, true 1028 } 1029 if rightValue == nil { 1030 return 1, true 1031 } 1032 if leftValue.String() == rightValue.String() { 1033 return 0, true 1034 } else if leftValue.String() < rightValue.String() { 1035 return -1, true 1036 } else { 1037 return 1, true 1038 } 1039 case ActivityLog_FieldPathSelectorScope: 1040 leftValue := fpv.value.(string) 1041 rightValue := source.GetScope() 1042 if (leftValue) == (rightValue) { 1043 return 0, true 1044 } else if (leftValue) < (rightValue) { 1045 return -1, true 1046 } else { 1047 return 1, true 1048 } 1049 case ActivityLog_FieldPathSelectorRequestId: 1050 leftValue := fpv.value.(uint64) 1051 rightValue := source.GetRequestId() 1052 if (leftValue) == (rightValue) { 1053 return 0, true 1054 } else if (leftValue) < (rightValue) { 1055 return -1, true 1056 } else { 1057 return 1, true 1058 } 1059 case ActivityLog_FieldPathSelectorAuthentication: 1060 return 0, false 1061 case ActivityLog_FieldPathSelectorAuthorization: 1062 return 0, false 1063 case ActivityLog_FieldPathSelectorService: 1064 return 0, false 1065 case ActivityLog_FieldPathSelectorMethod: 1066 return 0, false 1067 case ActivityLog_FieldPathSelectorRequestMetadata: 1068 return 0, false 1069 case ActivityLog_FieldPathSelectorRequestRouting: 1070 return 0, false 1071 case ActivityLog_FieldPathSelectorResource: 1072 return 0, false 1073 case ActivityLog_FieldPathSelectorCategory: 1074 leftValue := fpv.value.(ActivityLog_Category) 1075 rightValue := source.GetCategory() 1076 if (leftValue) == (rightValue) { 1077 return 0, true 1078 } else if (leftValue) < (rightValue) { 1079 return -1, true 1080 } else { 1081 return 1, true 1082 } 1083 case ActivityLog_FieldPathSelectorLabels: 1084 return 0, false 1085 case ActivityLog_FieldPathSelectorEvents: 1086 return 0, false 1087 default: 1088 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpv.selector)) 1089 } 1090 } 1091 1092 func (fpv *ActivityLog_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1093 return fpv.CompareWith(source.(*ActivityLog)) 1094 } 1095 1096 type ActivityLog_FieldPathMapValue struct { 1097 ActivityLog_FieldPathMap 1098 value interface{} 1099 } 1100 1101 var _ ActivityLog_FieldPathValue = (*ActivityLog_FieldPathMapValue)(nil) 1102 1103 // GetValue returns value stored under selected field in ActivityLog as interface{} 1104 func (fpmv *ActivityLog_FieldPathMapValue) GetRawValue() interface{} { 1105 return fpmv.value 1106 } 1107 func (fpmv *ActivityLog_FieldPathMapValue) AsLabelsElementValue() (string, bool) { 1108 res, ok := fpmv.value.(string) 1109 return res, ok 1110 } 1111 1112 // SetTo stores value for selected field in ActivityLog 1113 func (fpmv *ActivityLog_FieldPathMapValue) SetTo(target **ActivityLog) { 1114 if *target == nil { 1115 *target = new(ActivityLog) 1116 } 1117 switch fpmv.selector { 1118 case ActivityLog_FieldPathSelectorLabels: 1119 if (*target).Labels == nil { 1120 (*target).Labels = make(map[string]string) 1121 } 1122 (*target).Labels[fpmv.key] = fpmv.value.(string) 1123 default: 1124 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpmv.selector)) 1125 } 1126 } 1127 1128 func (fpmv *ActivityLog_FieldPathMapValue) SetToRaw(target proto.Message) { 1129 typedObject := target.(*ActivityLog) 1130 fpmv.SetTo(&typedObject) 1131 } 1132 1133 // CompareWith compares value in the 'ActivityLog_FieldPathMapValue' with the value under path in 'ActivityLog'. 1134 func (fpmv *ActivityLog_FieldPathMapValue) CompareWith(source *ActivityLog) (int, bool) { 1135 switch fpmv.selector { 1136 case ActivityLog_FieldPathSelectorLabels: 1137 leftValue := fpmv.value.(string) 1138 rightValue := source.GetLabels()[fpmv.key] 1139 if (leftValue) == (rightValue) { 1140 return 0, true 1141 } else if (leftValue) < (rightValue) { 1142 return -1, true 1143 } else { 1144 return 1, true 1145 } 1146 default: 1147 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpmv.selector)) 1148 } 1149 } 1150 1151 func (fpmv *ActivityLog_FieldPathMapValue) CompareWithRaw(source proto.Message) (int, bool) { 1152 return fpmv.CompareWith(source.(*ActivityLog)) 1153 } 1154 1155 type ActivityLog_FieldSubPathValue struct { 1156 ActivityLog_FieldPath 1157 subPathValue gotenobject.FieldPathValue 1158 } 1159 1160 var _ ActivityLog_FieldPathValue = (*ActivityLog_FieldSubPathValue)(nil) 1161 1162 func (fpvs *ActivityLog_FieldSubPathValue) AsAuthenticationPathValue() (common.Authentication_FieldPathValue, bool) { 1163 res, ok := fpvs.subPathValue.(common.Authentication_FieldPathValue) 1164 return res, ok 1165 } 1166 func (fpvs *ActivityLog_FieldSubPathValue) AsAuthorizationPathValue() (common.Authorization_FieldPathValue, bool) { 1167 res, ok := fpvs.subPathValue.(common.Authorization_FieldPathValue) 1168 return res, ok 1169 } 1170 func (fpvs *ActivityLog_FieldSubPathValue) AsServicePathValue() (common.ServiceData_FieldPathValue, bool) { 1171 res, ok := fpvs.subPathValue.(common.ServiceData_FieldPathValue) 1172 return res, ok 1173 } 1174 func (fpvs *ActivityLog_FieldSubPathValue) AsMethodPathValue() (ActivityLogMethod_FieldPathValue, bool) { 1175 res, ok := fpvs.subPathValue.(ActivityLogMethod_FieldPathValue) 1176 return res, ok 1177 } 1178 func (fpvs *ActivityLog_FieldSubPathValue) AsRequestMetadataPathValue() (ActivityLogRequestMetadata_FieldPathValue, bool) { 1179 res, ok := fpvs.subPathValue.(ActivityLogRequestMetadata_FieldPathValue) 1180 return res, ok 1181 } 1182 func (fpvs *ActivityLog_FieldSubPathValue) AsRequestRoutingPathValue() (ActivityLogRequestRouting_FieldPathValue, bool) { 1183 res, ok := fpvs.subPathValue.(ActivityLogRequestRouting_FieldPathValue) 1184 return res, ok 1185 } 1186 func (fpvs *ActivityLog_FieldSubPathValue) AsResourcePathValue() (ActivityLogResource_FieldPathValue, bool) { 1187 res, ok := fpvs.subPathValue.(ActivityLogResource_FieldPathValue) 1188 return res, ok 1189 } 1190 func (fpvs *ActivityLog_FieldSubPathValue) AsEventsPathValue() (ActivityLogEvent_FieldPathValue, bool) { 1191 res, ok := fpvs.subPathValue.(ActivityLogEvent_FieldPathValue) 1192 return res, ok 1193 } 1194 1195 func (fpvs *ActivityLog_FieldSubPathValue) SetTo(target **ActivityLog) { 1196 if *target == nil { 1197 *target = new(ActivityLog) 1198 } 1199 switch fpvs.Selector() { 1200 case ActivityLog_FieldPathSelectorAuthentication: 1201 fpvs.subPathValue.(common.Authentication_FieldPathValue).SetTo(&(*target).Authentication) 1202 case ActivityLog_FieldPathSelectorAuthorization: 1203 fpvs.subPathValue.(common.Authorization_FieldPathValue).SetTo(&(*target).Authorization) 1204 case ActivityLog_FieldPathSelectorService: 1205 fpvs.subPathValue.(common.ServiceData_FieldPathValue).SetTo(&(*target).Service) 1206 case ActivityLog_FieldPathSelectorMethod: 1207 fpvs.subPathValue.(ActivityLogMethod_FieldPathValue).SetTo(&(*target).Method) 1208 case ActivityLog_FieldPathSelectorRequestMetadata: 1209 fpvs.subPathValue.(ActivityLogRequestMetadata_FieldPathValue).SetTo(&(*target).RequestMetadata) 1210 case ActivityLog_FieldPathSelectorRequestRouting: 1211 fpvs.subPathValue.(ActivityLogRequestRouting_FieldPathValue).SetTo(&(*target).RequestRouting) 1212 case ActivityLog_FieldPathSelectorResource: 1213 fpvs.subPathValue.(ActivityLogResource_FieldPathValue).SetTo(&(*target).Resource) 1214 case ActivityLog_FieldPathSelectorEvents: 1215 panic("FieldPath setter is unsupported for array subpaths") 1216 default: 1217 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpvs.Selector())) 1218 } 1219 } 1220 1221 func (fpvs *ActivityLog_FieldSubPathValue) SetToRaw(target proto.Message) { 1222 typedObject := target.(*ActivityLog) 1223 fpvs.SetTo(&typedObject) 1224 } 1225 1226 func (fpvs *ActivityLog_FieldSubPathValue) GetRawValue() interface{} { 1227 return fpvs.subPathValue.GetRawValue() 1228 } 1229 1230 func (fpvs *ActivityLog_FieldSubPathValue) CompareWith(source *ActivityLog) (int, bool) { 1231 switch fpvs.Selector() { 1232 case ActivityLog_FieldPathSelectorAuthentication: 1233 return fpvs.subPathValue.(common.Authentication_FieldPathValue).CompareWith(source.GetAuthentication()) 1234 case ActivityLog_FieldPathSelectorAuthorization: 1235 return fpvs.subPathValue.(common.Authorization_FieldPathValue).CompareWith(source.GetAuthorization()) 1236 case ActivityLog_FieldPathSelectorService: 1237 return fpvs.subPathValue.(common.ServiceData_FieldPathValue).CompareWith(source.GetService()) 1238 case ActivityLog_FieldPathSelectorMethod: 1239 return fpvs.subPathValue.(ActivityLogMethod_FieldPathValue).CompareWith(source.GetMethod()) 1240 case ActivityLog_FieldPathSelectorRequestMetadata: 1241 return fpvs.subPathValue.(ActivityLogRequestMetadata_FieldPathValue).CompareWith(source.GetRequestMetadata()) 1242 case ActivityLog_FieldPathSelectorRequestRouting: 1243 return fpvs.subPathValue.(ActivityLogRequestRouting_FieldPathValue).CompareWith(source.GetRequestRouting()) 1244 case ActivityLog_FieldPathSelectorResource: 1245 return fpvs.subPathValue.(ActivityLogResource_FieldPathValue).CompareWith(source.GetResource()) 1246 case ActivityLog_FieldPathSelectorEvents: 1247 return 0, false // repeated field 1248 default: 1249 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpvs.Selector())) 1250 } 1251 } 1252 1253 func (fpvs *ActivityLog_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1254 return fpvs.CompareWith(source.(*ActivityLog)) 1255 } 1256 1257 // ActivityLog_FieldPathArrayItemValue allows storing single item in Path-specific values for ActivityLog according to their type 1258 // Present only for array (repeated) types. 1259 type ActivityLog_FieldPathArrayItemValue interface { 1260 gotenobject.FieldPathArrayItemValue 1261 ActivityLog_FieldPath 1262 ContainsValue(*ActivityLog) bool 1263 } 1264 1265 // ParseActivityLog_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1266 func ParseActivityLog_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLog_FieldPathArrayItemValue, error) { 1267 fp, err := ParseActivityLog_FieldPath(pathStr) 1268 if err != nil { 1269 return nil, err 1270 } 1271 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1272 if err != nil { 1273 return nil, status.Errorf(codes.InvalidArgument, "error parsing ActivityLog field path array item value from %s: %v", valueStr, err) 1274 } 1275 return fpaiv.(ActivityLog_FieldPathArrayItemValue), nil 1276 } 1277 1278 func MustParseActivityLog_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLog_FieldPathArrayItemValue { 1279 fpaiv, err := ParseActivityLog_FieldPathArrayItemValue(pathStr, valueStr) 1280 if err != nil { 1281 panic(err) 1282 } 1283 return fpaiv 1284 } 1285 1286 type ActivityLog_FieldTerminalPathArrayItemValue struct { 1287 ActivityLog_FieldTerminalPath 1288 value interface{} 1289 } 1290 1291 var _ ActivityLog_FieldPathArrayItemValue = (*ActivityLog_FieldTerminalPathArrayItemValue)(nil) 1292 1293 // GetRawValue returns stored element value for array in object ActivityLog as interface{} 1294 func (fpaiv *ActivityLog_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1295 return fpaiv.value 1296 } 1297 func (fpaiv *ActivityLog_FieldTerminalPathArrayItemValue) AsEventsItemValue() (*ActivityLog_Event, bool) { 1298 res, ok := fpaiv.value.(*ActivityLog_Event) 1299 return res, ok 1300 } 1301 1302 func (fpaiv *ActivityLog_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog) (interface{}, bool) { 1303 return nil, false 1304 } 1305 1306 func (fpaiv *ActivityLog_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1307 return fpaiv.GetSingle(source.(*ActivityLog)) 1308 } 1309 1310 // Contains returns a boolean indicating if value that is being held is present in given 'ActivityLog' 1311 func (fpaiv *ActivityLog_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog) bool { 1312 slice := fpaiv.ActivityLog_FieldTerminalPath.Get(source) 1313 for _, v := range slice { 1314 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1315 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1316 return true 1317 } 1318 } else if reflect.DeepEqual(v, fpaiv.value) { 1319 return true 1320 } 1321 } 1322 return false 1323 } 1324 1325 type ActivityLog_FieldSubPathArrayItemValue struct { 1326 ActivityLog_FieldPath 1327 subPathItemValue gotenobject.FieldPathArrayItemValue 1328 } 1329 1330 // GetRawValue returns stored array item value 1331 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 1332 return fpaivs.subPathItemValue.GetRawItemValue() 1333 } 1334 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) AsAuthenticationPathItemValue() (common.Authentication_FieldPathArrayItemValue, bool) { 1335 res, ok := fpaivs.subPathItemValue.(common.Authentication_FieldPathArrayItemValue) 1336 return res, ok 1337 } 1338 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) AsAuthorizationPathItemValue() (common.Authorization_FieldPathArrayItemValue, bool) { 1339 res, ok := fpaivs.subPathItemValue.(common.Authorization_FieldPathArrayItemValue) 1340 return res, ok 1341 } 1342 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) AsServicePathItemValue() (common.ServiceData_FieldPathArrayItemValue, bool) { 1343 res, ok := fpaivs.subPathItemValue.(common.ServiceData_FieldPathArrayItemValue) 1344 return res, ok 1345 } 1346 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) AsMethodPathItemValue() (ActivityLogMethod_FieldPathArrayItemValue, bool) { 1347 res, ok := fpaivs.subPathItemValue.(ActivityLogMethod_FieldPathArrayItemValue) 1348 return res, ok 1349 } 1350 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) AsRequestMetadataPathItemValue() (ActivityLogRequestMetadata_FieldPathArrayItemValue, bool) { 1351 res, ok := fpaivs.subPathItemValue.(ActivityLogRequestMetadata_FieldPathArrayItemValue) 1352 return res, ok 1353 } 1354 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) AsRequestRoutingPathItemValue() (ActivityLogRequestRouting_FieldPathArrayItemValue, bool) { 1355 res, ok := fpaivs.subPathItemValue.(ActivityLogRequestRouting_FieldPathArrayItemValue) 1356 return res, ok 1357 } 1358 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) AsResourcePathItemValue() (ActivityLogResource_FieldPathArrayItemValue, bool) { 1359 res, ok := fpaivs.subPathItemValue.(ActivityLogResource_FieldPathArrayItemValue) 1360 return res, ok 1361 } 1362 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) AsEventsPathItemValue() (ActivityLogEvent_FieldPathArrayItemValue, bool) { 1363 res, ok := fpaivs.subPathItemValue.(ActivityLogEvent_FieldPathArrayItemValue) 1364 return res, ok 1365 } 1366 1367 // Contains returns a boolean indicating if value that is being held is present in given 'ActivityLog' 1368 func (fpaivs *ActivityLog_FieldSubPathArrayItemValue) ContainsValue(source *ActivityLog) bool { 1369 switch fpaivs.Selector() { 1370 case ActivityLog_FieldPathSelectorAuthentication: 1371 return fpaivs.subPathItemValue.(common.Authentication_FieldPathArrayItemValue).ContainsValue(source.GetAuthentication()) 1372 case ActivityLog_FieldPathSelectorAuthorization: 1373 return fpaivs.subPathItemValue.(common.Authorization_FieldPathArrayItemValue).ContainsValue(source.GetAuthorization()) 1374 case ActivityLog_FieldPathSelectorService: 1375 return fpaivs.subPathItemValue.(common.ServiceData_FieldPathArrayItemValue).ContainsValue(source.GetService()) 1376 case ActivityLog_FieldPathSelectorMethod: 1377 return fpaivs.subPathItemValue.(ActivityLogMethod_FieldPathArrayItemValue).ContainsValue(source.GetMethod()) 1378 case ActivityLog_FieldPathSelectorRequestMetadata: 1379 return fpaivs.subPathItemValue.(ActivityLogRequestMetadata_FieldPathArrayItemValue).ContainsValue(source.GetRequestMetadata()) 1380 case ActivityLog_FieldPathSelectorRequestRouting: 1381 return fpaivs.subPathItemValue.(ActivityLogRequestRouting_FieldPathArrayItemValue).ContainsValue(source.GetRequestRouting()) 1382 case ActivityLog_FieldPathSelectorResource: 1383 return fpaivs.subPathItemValue.(ActivityLogResource_FieldPathArrayItemValue).ContainsValue(source.GetResource()) 1384 case ActivityLog_FieldPathSelectorEvents: 1385 return false // repeated/map field 1386 default: 1387 panic(fmt.Sprintf("Invalid selector for ActivityLog: %d", fpaivs.Selector())) 1388 } 1389 } 1390 1391 // ActivityLog_FieldPathArrayOfValues allows storing slice of values for ActivityLog fields according to their type 1392 type ActivityLog_FieldPathArrayOfValues interface { 1393 gotenobject.FieldPathArrayOfValues 1394 ActivityLog_FieldPath 1395 } 1396 1397 func ParseActivityLog_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLog_FieldPathArrayOfValues, error) { 1398 fp, err := ParseActivityLog_FieldPath(pathStr) 1399 if err != nil { 1400 return nil, err 1401 } 1402 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1403 if err != nil { 1404 return nil, status.Errorf(codes.InvalidArgument, "error parsing ActivityLog field path array of values from %s: %v", valuesStr, err) 1405 } 1406 return fpaov.(ActivityLog_FieldPathArrayOfValues), nil 1407 } 1408 1409 func MustParseActivityLog_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLog_FieldPathArrayOfValues { 1410 fpaov, err := ParseActivityLog_FieldPathArrayOfValues(pathStr, valuesStr) 1411 if err != nil { 1412 panic(err) 1413 } 1414 return fpaov 1415 } 1416 1417 type ActivityLog_FieldTerminalPathArrayOfValues struct { 1418 ActivityLog_FieldTerminalPath 1419 values interface{} 1420 } 1421 1422 var _ ActivityLog_FieldPathArrayOfValues = (*ActivityLog_FieldTerminalPathArrayOfValues)(nil) 1423 1424 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1425 switch fpaov.selector { 1426 case ActivityLog_FieldPathSelectorName: 1427 for _, v := range fpaov.values.([]*Name) { 1428 values = append(values, v) 1429 } 1430 case ActivityLog_FieldPathSelectorScope: 1431 for _, v := range fpaov.values.([]string) { 1432 values = append(values, v) 1433 } 1434 case ActivityLog_FieldPathSelectorRequestId: 1435 for _, v := range fpaov.values.([]uint64) { 1436 values = append(values, v) 1437 } 1438 case ActivityLog_FieldPathSelectorAuthentication: 1439 for _, v := range fpaov.values.([]*common.Authentication) { 1440 values = append(values, v) 1441 } 1442 case ActivityLog_FieldPathSelectorAuthorization: 1443 for _, v := range fpaov.values.([]*common.Authorization) { 1444 values = append(values, v) 1445 } 1446 case ActivityLog_FieldPathSelectorService: 1447 for _, v := range fpaov.values.([]*common.ServiceData) { 1448 values = append(values, v) 1449 } 1450 case ActivityLog_FieldPathSelectorMethod: 1451 for _, v := range fpaov.values.([]*ActivityLog_Method) { 1452 values = append(values, v) 1453 } 1454 case ActivityLog_FieldPathSelectorRequestMetadata: 1455 for _, v := range fpaov.values.([]*ActivityLog_RequestMetadata) { 1456 values = append(values, v) 1457 } 1458 case ActivityLog_FieldPathSelectorRequestRouting: 1459 for _, v := range fpaov.values.([]*ActivityLog_RequestRouting) { 1460 values = append(values, v) 1461 } 1462 case ActivityLog_FieldPathSelectorResource: 1463 for _, v := range fpaov.values.([]*ActivityLog_Resource) { 1464 values = append(values, v) 1465 } 1466 case ActivityLog_FieldPathSelectorCategory: 1467 for _, v := range fpaov.values.([]ActivityLog_Category) { 1468 values = append(values, v) 1469 } 1470 case ActivityLog_FieldPathSelectorLabels: 1471 for _, v := range fpaov.values.([]map[string]string) { 1472 values = append(values, v) 1473 } 1474 case ActivityLog_FieldPathSelectorEvents: 1475 for _, v := range fpaov.values.([][]*ActivityLog_Event) { 1476 values = append(values, v) 1477 } 1478 } 1479 return 1480 } 1481 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) { 1482 res, ok := fpaov.values.([]*Name) 1483 return res, ok 1484 } 1485 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsScopeArrayOfValues() ([]string, bool) { 1486 res, ok := fpaov.values.([]string) 1487 return res, ok 1488 } 1489 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsRequestIdArrayOfValues() ([]uint64, bool) { 1490 res, ok := fpaov.values.([]uint64) 1491 return res, ok 1492 } 1493 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsAuthenticationArrayOfValues() ([]*common.Authentication, bool) { 1494 res, ok := fpaov.values.([]*common.Authentication) 1495 return res, ok 1496 } 1497 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsAuthorizationArrayOfValues() ([]*common.Authorization, bool) { 1498 res, ok := fpaov.values.([]*common.Authorization) 1499 return res, ok 1500 } 1501 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsServiceArrayOfValues() ([]*common.ServiceData, bool) { 1502 res, ok := fpaov.values.([]*common.ServiceData) 1503 return res, ok 1504 } 1505 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsMethodArrayOfValues() ([]*ActivityLog_Method, bool) { 1506 res, ok := fpaov.values.([]*ActivityLog_Method) 1507 return res, ok 1508 } 1509 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsRequestMetadataArrayOfValues() ([]*ActivityLog_RequestMetadata, bool) { 1510 res, ok := fpaov.values.([]*ActivityLog_RequestMetadata) 1511 return res, ok 1512 } 1513 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsRequestRoutingArrayOfValues() ([]*ActivityLog_RequestRouting, bool) { 1514 res, ok := fpaov.values.([]*ActivityLog_RequestRouting) 1515 return res, ok 1516 } 1517 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsResourceArrayOfValues() ([]*ActivityLog_Resource, bool) { 1518 res, ok := fpaov.values.([]*ActivityLog_Resource) 1519 return res, ok 1520 } 1521 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsCategoryArrayOfValues() ([]ActivityLog_Category, bool) { 1522 res, ok := fpaov.values.([]ActivityLog_Category) 1523 return res, ok 1524 } 1525 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsLabelsArrayOfValues() ([]map[string]string, bool) { 1526 res, ok := fpaov.values.([]map[string]string) 1527 return res, ok 1528 } 1529 func (fpaov *ActivityLog_FieldTerminalPathArrayOfValues) AsEventsArrayOfValues() ([][]*ActivityLog_Event, bool) { 1530 res, ok := fpaov.values.([][]*ActivityLog_Event) 1531 return res, ok 1532 } 1533 1534 type ActivityLog_FieldPathMapArrayOfValues struct { 1535 ActivityLog_FieldPathMap 1536 values interface{} 1537 } 1538 1539 var _ ActivityLog_FieldPathArrayOfValues = (*ActivityLog_FieldPathMapArrayOfValues)(nil) 1540 1541 func (fpmaov *ActivityLog_FieldPathMapArrayOfValues) GetRawValues() (values []interface{}) { 1542 switch fpmaov.selector { 1543 case ActivityLog_FieldPathSelectorLabels: 1544 for _, v := range fpmaov.values.([]string) { 1545 values = append(values, v) 1546 } 1547 } 1548 return 1549 } 1550 func (fpmaov *ActivityLog_FieldPathMapArrayOfValues) AsLabelsArrayOfElementValues() ([]string, bool) { 1551 res, ok := fpmaov.values.([]string) 1552 return res, ok 1553 } 1554 1555 type ActivityLog_FieldSubPathArrayOfValues struct { 1556 ActivityLog_FieldPath 1557 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 1558 } 1559 1560 var _ ActivityLog_FieldPathArrayOfValues = (*ActivityLog_FieldSubPathArrayOfValues)(nil) 1561 1562 func (fpsaov *ActivityLog_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 1563 return fpsaov.subPathArrayOfValues.GetRawValues() 1564 } 1565 func (fpsaov *ActivityLog_FieldSubPathArrayOfValues) AsAuthenticationPathArrayOfValues() (common.Authentication_FieldPathArrayOfValues, bool) { 1566 res, ok := fpsaov.subPathArrayOfValues.(common.Authentication_FieldPathArrayOfValues) 1567 return res, ok 1568 } 1569 func (fpsaov *ActivityLog_FieldSubPathArrayOfValues) AsAuthorizationPathArrayOfValues() (common.Authorization_FieldPathArrayOfValues, bool) { 1570 res, ok := fpsaov.subPathArrayOfValues.(common.Authorization_FieldPathArrayOfValues) 1571 return res, ok 1572 } 1573 func (fpsaov *ActivityLog_FieldSubPathArrayOfValues) AsServicePathArrayOfValues() (common.ServiceData_FieldPathArrayOfValues, bool) { 1574 res, ok := fpsaov.subPathArrayOfValues.(common.ServiceData_FieldPathArrayOfValues) 1575 return res, ok 1576 } 1577 func (fpsaov *ActivityLog_FieldSubPathArrayOfValues) AsMethodPathArrayOfValues() (ActivityLogMethod_FieldPathArrayOfValues, bool) { 1578 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogMethod_FieldPathArrayOfValues) 1579 return res, ok 1580 } 1581 func (fpsaov *ActivityLog_FieldSubPathArrayOfValues) AsRequestMetadataPathArrayOfValues() (ActivityLogRequestMetadata_FieldPathArrayOfValues, bool) { 1582 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogRequestMetadata_FieldPathArrayOfValues) 1583 return res, ok 1584 } 1585 func (fpsaov *ActivityLog_FieldSubPathArrayOfValues) AsRequestRoutingPathArrayOfValues() (ActivityLogRequestRouting_FieldPathArrayOfValues, bool) { 1586 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogRequestRouting_FieldPathArrayOfValues) 1587 return res, ok 1588 } 1589 func (fpsaov *ActivityLog_FieldSubPathArrayOfValues) AsResourcePathArrayOfValues() (ActivityLogResource_FieldPathArrayOfValues, bool) { 1590 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogResource_FieldPathArrayOfValues) 1591 return res, ok 1592 } 1593 func (fpsaov *ActivityLog_FieldSubPathArrayOfValues) AsEventsPathArrayOfValues() (ActivityLogEvent_FieldPathArrayOfValues, bool) { 1594 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogEvent_FieldPathArrayOfValues) 1595 return res, ok 1596 } 1597 1598 // FieldPath provides implementation to handle 1599 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1600 type ActivityLogEvent_FieldPath interface { 1601 gotenobject.FieldPath 1602 Selector() ActivityLogEvent_FieldPathSelector 1603 Get(source *ActivityLog_Event) []interface{} 1604 GetSingle(source *ActivityLog_Event) (interface{}, bool) 1605 ClearValue(item *ActivityLog_Event) 1606 1607 // Those methods build corresponding ActivityLogEvent_FieldPathValue 1608 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1609 WithIValue(value interface{}) ActivityLogEvent_FieldPathValue 1610 WithIArrayOfValues(values interface{}) ActivityLogEvent_FieldPathArrayOfValues 1611 WithIArrayItemValue(value interface{}) ActivityLogEvent_FieldPathArrayItemValue 1612 } 1613 1614 type ActivityLogEvent_FieldPathSelector int32 1615 1616 const ( 1617 ActivityLogEvent_FieldPathSelectorClientMessage ActivityLogEvent_FieldPathSelector = 0 1618 ActivityLogEvent_FieldPathSelectorServerMessage ActivityLogEvent_FieldPathSelector = 1 1619 ActivityLogEvent_FieldPathSelectorExit ActivityLogEvent_FieldPathSelector = 2 1620 ActivityLogEvent_FieldPathSelectorRegionalServerMessage ActivityLogEvent_FieldPathSelector = 3 1621 ActivityLogEvent_FieldPathSelectorRegionalExit ActivityLogEvent_FieldPathSelector = 4 1622 ) 1623 1624 func (s ActivityLogEvent_FieldPathSelector) String() string { 1625 switch s { 1626 case ActivityLogEvent_FieldPathSelectorClientMessage: 1627 return "client_message" 1628 case ActivityLogEvent_FieldPathSelectorServerMessage: 1629 return "server_message" 1630 case ActivityLogEvent_FieldPathSelectorExit: 1631 return "exit" 1632 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 1633 return "regional_server_message" 1634 case ActivityLogEvent_FieldPathSelectorRegionalExit: 1635 return "regional_exit" 1636 default: 1637 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", s)) 1638 } 1639 } 1640 1641 func BuildActivityLogEvent_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogEvent_FieldPath, error) { 1642 if len(fp) == 0 { 1643 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_Event") 1644 } 1645 if len(fp) == 1 { 1646 switch fp[0] { 1647 case "client_message", "clientMessage", "client-message": 1648 return &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorClientMessage}, nil 1649 case "server_message", "serverMessage", "server-message": 1650 return &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorServerMessage}, nil 1651 case "exit": 1652 return &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorExit}, nil 1653 case "regional_server_message", "regionalServerMessage", "regional-server-message": 1654 return &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorRegionalServerMessage}, nil 1655 case "regional_exit", "regionalExit", "regional-exit": 1656 return &ActivityLogEvent_FieldTerminalPath{selector: ActivityLogEvent_FieldPathSelectorRegionalExit}, nil 1657 } 1658 } else { 1659 switch fp[0] { 1660 case "client_message", "clientMessage", "client-message": 1661 if subpath, err := BuildActivityLogEventClientMsgEvent_FieldPath(fp[1:]); err != nil { 1662 return nil, err 1663 } else { 1664 return &ActivityLogEvent_FieldSubPath{selector: ActivityLogEvent_FieldPathSelectorClientMessage, subPath: subpath}, nil 1665 } 1666 case "server_message", "serverMessage", "server-message": 1667 if subpath, err := BuildActivityLogEventServerMsgEvent_FieldPath(fp[1:]); err != nil { 1668 return nil, err 1669 } else { 1670 return &ActivityLogEvent_FieldSubPath{selector: ActivityLogEvent_FieldPathSelectorServerMessage, subPath: subpath}, nil 1671 } 1672 case "exit": 1673 if subpath, err := BuildActivityLogEventExitEvent_FieldPath(fp[1:]); err != nil { 1674 return nil, err 1675 } else { 1676 return &ActivityLogEvent_FieldSubPath{selector: ActivityLogEvent_FieldPathSelectorExit, subPath: subpath}, nil 1677 } 1678 case "regional_server_message", "regionalServerMessage", "regional-server-message": 1679 if subpath, err := BuildActivityLogEventRegionalServerMsgEvent_FieldPath(fp[1:]); err != nil { 1680 return nil, err 1681 } else { 1682 return &ActivityLogEvent_FieldSubPath{selector: ActivityLogEvent_FieldPathSelectorRegionalServerMessage, subPath: subpath}, nil 1683 } 1684 case "regional_exit", "regionalExit", "regional-exit": 1685 if subpath, err := BuildActivityLogEventRegionalServerMsgEvent_FieldPath(fp[1:]); err != nil { 1686 return nil, err 1687 } else { 1688 return &ActivityLogEvent_FieldSubPath{selector: ActivityLogEvent_FieldPathSelectorRegionalExit, subPath: subpath}, nil 1689 } 1690 } 1691 } 1692 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_Event", fp) 1693 } 1694 1695 func ParseActivityLogEvent_FieldPath(rawField string) (ActivityLogEvent_FieldPath, error) { 1696 fp, err := gotenobject.ParseRawFieldPath(rawField) 1697 if err != nil { 1698 return nil, err 1699 } 1700 return BuildActivityLogEvent_FieldPath(fp) 1701 } 1702 1703 func MustParseActivityLogEvent_FieldPath(rawField string) ActivityLogEvent_FieldPath { 1704 fp, err := ParseActivityLogEvent_FieldPath(rawField) 1705 if err != nil { 1706 panic(err) 1707 } 1708 return fp 1709 } 1710 1711 type ActivityLogEvent_FieldTerminalPath struct { 1712 selector ActivityLogEvent_FieldPathSelector 1713 } 1714 1715 var _ ActivityLogEvent_FieldPath = (*ActivityLogEvent_FieldTerminalPath)(nil) 1716 1717 func (fp *ActivityLogEvent_FieldTerminalPath) Selector() ActivityLogEvent_FieldPathSelector { 1718 return fp.selector 1719 } 1720 1721 // String returns path representation in proto convention 1722 func (fp *ActivityLogEvent_FieldTerminalPath) String() string { 1723 return fp.selector.String() 1724 } 1725 1726 // JSONString returns path representation is JSON convention 1727 func (fp *ActivityLogEvent_FieldTerminalPath) JSONString() string { 1728 return strcase.ToLowerCamel(fp.String()) 1729 } 1730 1731 // Get returns all values pointed by specific field from source ActivityLog_Event 1732 func (fp *ActivityLogEvent_FieldTerminalPath) Get(source *ActivityLog_Event) (values []interface{}) { 1733 if source != nil { 1734 switch fp.selector { 1735 case ActivityLogEvent_FieldPathSelectorClientMessage: 1736 if source, ok := source.Evt.(*ActivityLog_Event_ClientMessage); ok && source != nil { 1737 if source.ClientMessage != nil { 1738 values = append(values, source.ClientMessage) 1739 } 1740 } 1741 case ActivityLogEvent_FieldPathSelectorServerMessage: 1742 if source, ok := source.Evt.(*ActivityLog_Event_ServerMessage); ok && source != nil { 1743 if source.ServerMessage != nil { 1744 values = append(values, source.ServerMessage) 1745 } 1746 } 1747 case ActivityLogEvent_FieldPathSelectorExit: 1748 if source, ok := source.Evt.(*ActivityLog_Event_Exit); ok && source != nil { 1749 if source.Exit != nil { 1750 values = append(values, source.Exit) 1751 } 1752 } 1753 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 1754 if source, ok := source.Evt.(*ActivityLog_Event_RegionalServerMessage); ok && source != nil { 1755 if source.RegionalServerMessage != nil { 1756 values = append(values, source.RegionalServerMessage) 1757 } 1758 } 1759 case ActivityLogEvent_FieldPathSelectorRegionalExit: 1760 if source, ok := source.Evt.(*ActivityLog_Event_RegionalExit); ok && source != nil { 1761 if source.RegionalExit != nil { 1762 values = append(values, source.RegionalExit) 1763 } 1764 } 1765 default: 1766 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fp.selector)) 1767 } 1768 } 1769 return 1770 } 1771 1772 func (fp *ActivityLogEvent_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1773 return fp.Get(source.(*ActivityLog_Event)) 1774 } 1775 1776 // GetSingle returns value pointed by specific field of from source ActivityLog_Event 1777 func (fp *ActivityLogEvent_FieldTerminalPath) GetSingle(source *ActivityLog_Event) (interface{}, bool) { 1778 switch fp.selector { 1779 case ActivityLogEvent_FieldPathSelectorClientMessage: 1780 // if object nil or oneof not active, return "default" type with false flag. 1781 if source == nil { 1782 return source.GetClientMessage(), false 1783 } 1784 _, oneOfSelected := source.Evt.(*ActivityLog_Event_ClientMessage) 1785 if !oneOfSelected { 1786 return source.GetClientMessage(), false // to return "type" information 1787 } 1788 res := source.GetClientMessage() 1789 return res, res != nil 1790 case ActivityLogEvent_FieldPathSelectorServerMessage: 1791 // if object nil or oneof not active, return "default" type with false flag. 1792 if source == nil { 1793 return source.GetServerMessage(), false 1794 } 1795 _, oneOfSelected := source.Evt.(*ActivityLog_Event_ServerMessage) 1796 if !oneOfSelected { 1797 return source.GetServerMessage(), false // to return "type" information 1798 } 1799 res := source.GetServerMessage() 1800 return res, res != nil 1801 case ActivityLogEvent_FieldPathSelectorExit: 1802 // if object nil or oneof not active, return "default" type with false flag. 1803 if source == nil { 1804 return source.GetExit(), false 1805 } 1806 _, oneOfSelected := source.Evt.(*ActivityLog_Event_Exit) 1807 if !oneOfSelected { 1808 return source.GetExit(), false // to return "type" information 1809 } 1810 res := source.GetExit() 1811 return res, res != nil 1812 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 1813 // if object nil or oneof not active, return "default" type with false flag. 1814 if source == nil { 1815 return source.GetRegionalServerMessage(), false 1816 } 1817 _, oneOfSelected := source.Evt.(*ActivityLog_Event_RegionalServerMessage) 1818 if !oneOfSelected { 1819 return source.GetRegionalServerMessage(), false // to return "type" information 1820 } 1821 res := source.GetRegionalServerMessage() 1822 return res, res != nil 1823 case ActivityLogEvent_FieldPathSelectorRegionalExit: 1824 // if object nil or oneof not active, return "default" type with false flag. 1825 if source == nil { 1826 return source.GetRegionalExit(), false 1827 } 1828 _, oneOfSelected := source.Evt.(*ActivityLog_Event_RegionalExit) 1829 if !oneOfSelected { 1830 return source.GetRegionalExit(), false // to return "type" information 1831 } 1832 res := source.GetRegionalExit() 1833 return res, res != nil 1834 default: 1835 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fp.selector)) 1836 } 1837 } 1838 1839 func (fp *ActivityLogEvent_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1840 return fp.GetSingle(source.(*ActivityLog_Event)) 1841 } 1842 1843 // GetDefault returns a default value of the field type 1844 func (fp *ActivityLogEvent_FieldTerminalPath) GetDefault() interface{} { 1845 switch fp.selector { 1846 case ActivityLogEvent_FieldPathSelectorClientMessage: 1847 return (*ActivityLog_Event_ClientMsgEvent)(nil) 1848 case ActivityLogEvent_FieldPathSelectorServerMessage: 1849 return (*ActivityLog_Event_ServerMsgEvent)(nil) 1850 case ActivityLogEvent_FieldPathSelectorExit: 1851 return (*ActivityLog_Event_ExitEvent)(nil) 1852 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 1853 return (*ActivityLog_Event_RegionalServerMsgEvent)(nil) 1854 case ActivityLogEvent_FieldPathSelectorRegionalExit: 1855 return (*ActivityLog_Event_RegionalServerMsgEvent)(nil) 1856 default: 1857 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fp.selector)) 1858 } 1859 } 1860 1861 func (fp *ActivityLogEvent_FieldTerminalPath) ClearValue(item *ActivityLog_Event) { 1862 if item != nil { 1863 switch fp.selector { 1864 case ActivityLogEvent_FieldPathSelectorClientMessage: 1865 if item, ok := item.Evt.(*ActivityLog_Event_ClientMessage); ok { 1866 item.ClientMessage = nil 1867 } 1868 case ActivityLogEvent_FieldPathSelectorServerMessage: 1869 if item, ok := item.Evt.(*ActivityLog_Event_ServerMessage); ok { 1870 item.ServerMessage = nil 1871 } 1872 case ActivityLogEvent_FieldPathSelectorExit: 1873 if item, ok := item.Evt.(*ActivityLog_Event_Exit); ok { 1874 item.Exit = nil 1875 } 1876 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 1877 if item, ok := item.Evt.(*ActivityLog_Event_RegionalServerMessage); ok { 1878 item.RegionalServerMessage = nil 1879 } 1880 case ActivityLogEvent_FieldPathSelectorRegionalExit: 1881 if item, ok := item.Evt.(*ActivityLog_Event_RegionalExit); ok { 1882 item.RegionalExit = nil 1883 } 1884 default: 1885 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fp.selector)) 1886 } 1887 } 1888 } 1889 1890 func (fp *ActivityLogEvent_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1891 fp.ClearValue(item.(*ActivityLog_Event)) 1892 } 1893 1894 // IsLeaf - whether field path is holds simple value 1895 func (fp *ActivityLogEvent_FieldTerminalPath) IsLeaf() bool { 1896 return false 1897 } 1898 1899 func (fp *ActivityLogEvent_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1900 return []gotenobject.FieldPath{fp} 1901 } 1902 1903 func (fp *ActivityLogEvent_FieldTerminalPath) WithIValue(value interface{}) ActivityLogEvent_FieldPathValue { 1904 switch fp.selector { 1905 case ActivityLogEvent_FieldPathSelectorClientMessage: 1906 return &ActivityLogEvent_FieldTerminalPathValue{ActivityLogEvent_FieldTerminalPath: *fp, value: value.(*ActivityLog_Event_ClientMsgEvent)} 1907 case ActivityLogEvent_FieldPathSelectorServerMessage: 1908 return &ActivityLogEvent_FieldTerminalPathValue{ActivityLogEvent_FieldTerminalPath: *fp, value: value.(*ActivityLog_Event_ServerMsgEvent)} 1909 case ActivityLogEvent_FieldPathSelectorExit: 1910 return &ActivityLogEvent_FieldTerminalPathValue{ActivityLogEvent_FieldTerminalPath: *fp, value: value.(*ActivityLog_Event_ExitEvent)} 1911 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 1912 return &ActivityLogEvent_FieldTerminalPathValue{ActivityLogEvent_FieldTerminalPath: *fp, value: value.(*ActivityLog_Event_RegionalServerMsgEvent)} 1913 case ActivityLogEvent_FieldPathSelectorRegionalExit: 1914 return &ActivityLogEvent_FieldTerminalPathValue{ActivityLogEvent_FieldTerminalPath: *fp, value: value.(*ActivityLog_Event_RegionalServerMsgEvent)} 1915 default: 1916 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fp.selector)) 1917 } 1918 } 1919 1920 func (fp *ActivityLogEvent_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1921 return fp.WithIValue(value) 1922 } 1923 1924 func (fp *ActivityLogEvent_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogEvent_FieldPathArrayOfValues { 1925 fpaov := &ActivityLogEvent_FieldTerminalPathArrayOfValues{ActivityLogEvent_FieldTerminalPath: *fp} 1926 switch fp.selector { 1927 case ActivityLogEvent_FieldPathSelectorClientMessage: 1928 return &ActivityLogEvent_FieldTerminalPathArrayOfValues{ActivityLogEvent_FieldTerminalPath: *fp, values: values.([]*ActivityLog_Event_ClientMsgEvent)} 1929 case ActivityLogEvent_FieldPathSelectorServerMessage: 1930 return &ActivityLogEvent_FieldTerminalPathArrayOfValues{ActivityLogEvent_FieldTerminalPath: *fp, values: values.([]*ActivityLog_Event_ServerMsgEvent)} 1931 case ActivityLogEvent_FieldPathSelectorExit: 1932 return &ActivityLogEvent_FieldTerminalPathArrayOfValues{ActivityLogEvent_FieldTerminalPath: *fp, values: values.([]*ActivityLog_Event_ExitEvent)} 1933 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 1934 return &ActivityLogEvent_FieldTerminalPathArrayOfValues{ActivityLogEvent_FieldTerminalPath: *fp, values: values.([]*ActivityLog_Event_RegionalServerMsgEvent)} 1935 case ActivityLogEvent_FieldPathSelectorRegionalExit: 1936 return &ActivityLogEvent_FieldTerminalPathArrayOfValues{ActivityLogEvent_FieldTerminalPath: *fp, values: values.([]*ActivityLog_Event_RegionalServerMsgEvent)} 1937 default: 1938 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fp.selector)) 1939 } 1940 return fpaov 1941 } 1942 1943 func (fp *ActivityLogEvent_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1944 return fp.WithIArrayOfValues(values) 1945 } 1946 1947 func (fp *ActivityLogEvent_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogEvent_FieldPathArrayItemValue { 1948 switch fp.selector { 1949 default: 1950 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fp.selector)) 1951 } 1952 } 1953 1954 func (fp *ActivityLogEvent_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1955 return fp.WithIArrayItemValue(value) 1956 } 1957 1958 type ActivityLogEvent_FieldSubPath struct { 1959 selector ActivityLogEvent_FieldPathSelector 1960 subPath gotenobject.FieldPath 1961 } 1962 1963 var _ ActivityLogEvent_FieldPath = (*ActivityLogEvent_FieldSubPath)(nil) 1964 1965 func (fps *ActivityLogEvent_FieldSubPath) Selector() ActivityLogEvent_FieldPathSelector { 1966 return fps.selector 1967 } 1968 func (fps *ActivityLogEvent_FieldSubPath) AsClientMessageSubPath() (ActivityLogEventClientMsgEvent_FieldPath, bool) { 1969 res, ok := fps.subPath.(ActivityLogEventClientMsgEvent_FieldPath) 1970 return res, ok 1971 } 1972 func (fps *ActivityLogEvent_FieldSubPath) AsServerMessageSubPath() (ActivityLogEventServerMsgEvent_FieldPath, bool) { 1973 res, ok := fps.subPath.(ActivityLogEventServerMsgEvent_FieldPath) 1974 return res, ok 1975 } 1976 func (fps *ActivityLogEvent_FieldSubPath) AsExitSubPath() (ActivityLogEventExitEvent_FieldPath, bool) { 1977 res, ok := fps.subPath.(ActivityLogEventExitEvent_FieldPath) 1978 return res, ok 1979 } 1980 func (fps *ActivityLogEvent_FieldSubPath) AsRegionalServerMessageSubPath() (ActivityLogEventRegionalServerMsgEvent_FieldPath, bool) { 1981 res, ok := fps.subPath.(ActivityLogEventRegionalServerMsgEvent_FieldPath) 1982 return res, ok 1983 } 1984 func (fps *ActivityLogEvent_FieldSubPath) AsRegionalExitSubPath() (ActivityLogEventRegionalServerMsgEvent_FieldPath, bool) { 1985 res, ok := fps.subPath.(ActivityLogEventRegionalServerMsgEvent_FieldPath) 1986 return res, ok 1987 } 1988 1989 // String returns path representation in proto convention 1990 func (fps *ActivityLogEvent_FieldSubPath) String() string { 1991 return fps.selector.String() + "." + fps.subPath.String() 1992 } 1993 1994 // JSONString returns path representation is JSON convention 1995 func (fps *ActivityLogEvent_FieldSubPath) JSONString() string { 1996 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 1997 } 1998 1999 // Get returns all values pointed by selected field from source ActivityLog_Event 2000 func (fps *ActivityLogEvent_FieldSubPath) Get(source *ActivityLog_Event) (values []interface{}) { 2001 switch fps.selector { 2002 case ActivityLogEvent_FieldPathSelectorClientMessage: 2003 values = append(values, fps.subPath.GetRaw(source.GetClientMessage())...) 2004 case ActivityLogEvent_FieldPathSelectorServerMessage: 2005 values = append(values, fps.subPath.GetRaw(source.GetServerMessage())...) 2006 case ActivityLogEvent_FieldPathSelectorExit: 2007 values = append(values, fps.subPath.GetRaw(source.GetExit())...) 2008 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 2009 values = append(values, fps.subPath.GetRaw(source.GetRegionalServerMessage())...) 2010 case ActivityLogEvent_FieldPathSelectorRegionalExit: 2011 values = append(values, fps.subPath.GetRaw(source.GetRegionalExit())...) 2012 default: 2013 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fps.selector)) 2014 } 2015 return 2016 } 2017 2018 func (fps *ActivityLogEvent_FieldSubPath) GetRaw(source proto.Message) []interface{} { 2019 return fps.Get(source.(*ActivityLog_Event)) 2020 } 2021 2022 // GetSingle returns value of selected field from source ActivityLog_Event 2023 func (fps *ActivityLogEvent_FieldSubPath) GetSingle(source *ActivityLog_Event) (interface{}, bool) { 2024 switch fps.selector { 2025 case ActivityLogEvent_FieldPathSelectorClientMessage: 2026 if source.GetClientMessage() == nil { 2027 return nil, false 2028 } 2029 return fps.subPath.GetSingleRaw(source.GetClientMessage()) 2030 case ActivityLogEvent_FieldPathSelectorServerMessage: 2031 if source.GetServerMessage() == nil { 2032 return nil, false 2033 } 2034 return fps.subPath.GetSingleRaw(source.GetServerMessage()) 2035 case ActivityLogEvent_FieldPathSelectorExit: 2036 if source.GetExit() == nil { 2037 return nil, false 2038 } 2039 return fps.subPath.GetSingleRaw(source.GetExit()) 2040 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 2041 if source.GetRegionalServerMessage() == nil { 2042 return nil, false 2043 } 2044 return fps.subPath.GetSingleRaw(source.GetRegionalServerMessage()) 2045 case ActivityLogEvent_FieldPathSelectorRegionalExit: 2046 if source.GetRegionalExit() == nil { 2047 return nil, false 2048 } 2049 return fps.subPath.GetSingleRaw(source.GetRegionalExit()) 2050 default: 2051 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fps.selector)) 2052 } 2053 } 2054 2055 func (fps *ActivityLogEvent_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2056 return fps.GetSingle(source.(*ActivityLog_Event)) 2057 } 2058 2059 // GetDefault returns a default value of the field type 2060 func (fps *ActivityLogEvent_FieldSubPath) GetDefault() interface{} { 2061 return fps.subPath.GetDefault() 2062 } 2063 2064 func (fps *ActivityLogEvent_FieldSubPath) ClearValue(item *ActivityLog_Event) { 2065 if item != nil { 2066 switch fps.selector { 2067 case ActivityLogEvent_FieldPathSelectorClientMessage: 2068 if item.Evt != nil { 2069 if item, ok := item.Evt.(*ActivityLog_Event_ClientMessage); ok { 2070 fps.subPath.ClearValueRaw(item.ClientMessage) 2071 } 2072 } 2073 case ActivityLogEvent_FieldPathSelectorServerMessage: 2074 if item.Evt != nil { 2075 if item, ok := item.Evt.(*ActivityLog_Event_ServerMessage); ok { 2076 fps.subPath.ClearValueRaw(item.ServerMessage) 2077 } 2078 } 2079 case ActivityLogEvent_FieldPathSelectorExit: 2080 if item.Evt != nil { 2081 if item, ok := item.Evt.(*ActivityLog_Event_Exit); ok { 2082 fps.subPath.ClearValueRaw(item.Exit) 2083 } 2084 } 2085 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 2086 if item.Evt != nil { 2087 if item, ok := item.Evt.(*ActivityLog_Event_RegionalServerMessage); ok { 2088 fps.subPath.ClearValueRaw(item.RegionalServerMessage) 2089 } 2090 } 2091 case ActivityLogEvent_FieldPathSelectorRegionalExit: 2092 if item.Evt != nil { 2093 if item, ok := item.Evt.(*ActivityLog_Event_RegionalExit); ok { 2094 fps.subPath.ClearValueRaw(item.RegionalExit) 2095 } 2096 } 2097 default: 2098 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fps.selector)) 2099 } 2100 } 2101 } 2102 2103 func (fps *ActivityLogEvent_FieldSubPath) ClearValueRaw(item proto.Message) { 2104 fps.ClearValue(item.(*ActivityLog_Event)) 2105 } 2106 2107 // IsLeaf - whether field path is holds simple value 2108 func (fps *ActivityLogEvent_FieldSubPath) IsLeaf() bool { 2109 return fps.subPath.IsLeaf() 2110 } 2111 2112 func (fps *ActivityLogEvent_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2113 iPaths := []gotenobject.FieldPath{&ActivityLogEvent_FieldTerminalPath{selector: fps.selector}} 2114 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 2115 return iPaths 2116 } 2117 2118 func (fps *ActivityLogEvent_FieldSubPath) WithIValue(value interface{}) ActivityLogEvent_FieldPathValue { 2119 return &ActivityLogEvent_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 2120 } 2121 2122 func (fps *ActivityLogEvent_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2123 return fps.WithIValue(value) 2124 } 2125 2126 func (fps *ActivityLogEvent_FieldSubPath) WithIArrayOfValues(values interface{}) ActivityLogEvent_FieldPathArrayOfValues { 2127 return &ActivityLogEvent_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 2128 } 2129 2130 func (fps *ActivityLogEvent_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2131 return fps.WithIArrayOfValues(values) 2132 } 2133 2134 func (fps *ActivityLogEvent_FieldSubPath) WithIArrayItemValue(value interface{}) ActivityLogEvent_FieldPathArrayItemValue { 2135 return &ActivityLogEvent_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 2136 } 2137 2138 func (fps *ActivityLogEvent_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2139 return fps.WithIArrayItemValue(value) 2140 } 2141 2142 // ActivityLogEvent_FieldPathValue allows storing values for Event fields according to their type 2143 type ActivityLogEvent_FieldPathValue interface { 2144 ActivityLogEvent_FieldPath 2145 gotenobject.FieldPathValue 2146 SetTo(target **ActivityLog_Event) 2147 CompareWith(*ActivityLog_Event) (cmp int, comparable bool) 2148 } 2149 2150 func ParseActivityLogEvent_FieldPathValue(pathStr, valueStr string) (ActivityLogEvent_FieldPathValue, error) { 2151 fp, err := ParseActivityLogEvent_FieldPath(pathStr) 2152 if err != nil { 2153 return nil, err 2154 } 2155 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2156 if err != nil { 2157 return nil, status.Errorf(codes.InvalidArgument, "error parsing Event field path value from %s: %v", valueStr, err) 2158 } 2159 return fpv.(ActivityLogEvent_FieldPathValue), nil 2160 } 2161 2162 func MustParseActivityLogEvent_FieldPathValue(pathStr, valueStr string) ActivityLogEvent_FieldPathValue { 2163 fpv, err := ParseActivityLogEvent_FieldPathValue(pathStr, valueStr) 2164 if err != nil { 2165 panic(err) 2166 } 2167 return fpv 2168 } 2169 2170 type ActivityLogEvent_FieldTerminalPathValue struct { 2171 ActivityLogEvent_FieldTerminalPath 2172 value interface{} 2173 } 2174 2175 var _ ActivityLogEvent_FieldPathValue = (*ActivityLogEvent_FieldTerminalPathValue)(nil) 2176 2177 // GetRawValue returns raw value stored under selected path for 'Event' as interface{} 2178 func (fpv *ActivityLogEvent_FieldTerminalPathValue) GetRawValue() interface{} { 2179 return fpv.value 2180 } 2181 func (fpv *ActivityLogEvent_FieldTerminalPathValue) AsClientMessageValue() (*ActivityLog_Event_ClientMsgEvent, bool) { 2182 res, ok := fpv.value.(*ActivityLog_Event_ClientMsgEvent) 2183 return res, ok 2184 } 2185 func (fpv *ActivityLogEvent_FieldTerminalPathValue) AsServerMessageValue() (*ActivityLog_Event_ServerMsgEvent, bool) { 2186 res, ok := fpv.value.(*ActivityLog_Event_ServerMsgEvent) 2187 return res, ok 2188 } 2189 func (fpv *ActivityLogEvent_FieldTerminalPathValue) AsExitValue() (*ActivityLog_Event_ExitEvent, bool) { 2190 res, ok := fpv.value.(*ActivityLog_Event_ExitEvent) 2191 return res, ok 2192 } 2193 func (fpv *ActivityLogEvent_FieldTerminalPathValue) AsRegionalServerMessageValue() (*ActivityLog_Event_RegionalServerMsgEvent, bool) { 2194 res, ok := fpv.value.(*ActivityLog_Event_RegionalServerMsgEvent) 2195 return res, ok 2196 } 2197 func (fpv *ActivityLogEvent_FieldTerminalPathValue) AsRegionalExitValue() (*ActivityLog_Event_RegionalServerMsgEvent, bool) { 2198 res, ok := fpv.value.(*ActivityLog_Event_RegionalServerMsgEvent) 2199 return res, ok 2200 } 2201 2202 // SetTo stores value for selected field for object Event 2203 func (fpv *ActivityLogEvent_FieldTerminalPathValue) SetTo(target **ActivityLog_Event) { 2204 if *target == nil { 2205 *target = new(ActivityLog_Event) 2206 } 2207 switch fpv.selector { 2208 case ActivityLogEvent_FieldPathSelectorClientMessage: 2209 if _, ok := (*target).Evt.(*ActivityLog_Event_ClientMessage); !ok { 2210 (*target).Evt = &ActivityLog_Event_ClientMessage{} 2211 } 2212 (*target).Evt.(*ActivityLog_Event_ClientMessage).ClientMessage = fpv.value.(*ActivityLog_Event_ClientMsgEvent) 2213 case ActivityLogEvent_FieldPathSelectorServerMessage: 2214 if _, ok := (*target).Evt.(*ActivityLog_Event_ServerMessage); !ok { 2215 (*target).Evt = &ActivityLog_Event_ServerMessage{} 2216 } 2217 (*target).Evt.(*ActivityLog_Event_ServerMessage).ServerMessage = fpv.value.(*ActivityLog_Event_ServerMsgEvent) 2218 case ActivityLogEvent_FieldPathSelectorExit: 2219 if _, ok := (*target).Evt.(*ActivityLog_Event_Exit); !ok { 2220 (*target).Evt = &ActivityLog_Event_Exit{} 2221 } 2222 (*target).Evt.(*ActivityLog_Event_Exit).Exit = fpv.value.(*ActivityLog_Event_ExitEvent) 2223 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 2224 if _, ok := (*target).Evt.(*ActivityLog_Event_RegionalServerMessage); !ok { 2225 (*target).Evt = &ActivityLog_Event_RegionalServerMessage{} 2226 } 2227 (*target).Evt.(*ActivityLog_Event_RegionalServerMessage).RegionalServerMessage = fpv.value.(*ActivityLog_Event_RegionalServerMsgEvent) 2228 case ActivityLogEvent_FieldPathSelectorRegionalExit: 2229 if _, ok := (*target).Evt.(*ActivityLog_Event_RegionalExit); !ok { 2230 (*target).Evt = &ActivityLog_Event_RegionalExit{} 2231 } 2232 (*target).Evt.(*ActivityLog_Event_RegionalExit).RegionalExit = fpv.value.(*ActivityLog_Event_RegionalServerMsgEvent) 2233 default: 2234 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fpv.selector)) 2235 } 2236 } 2237 2238 func (fpv *ActivityLogEvent_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2239 typedObject := target.(*ActivityLog_Event) 2240 fpv.SetTo(&typedObject) 2241 } 2242 2243 // CompareWith compares value in the 'ActivityLogEvent_FieldTerminalPathValue' with the value under path in 'ActivityLog_Event'. 2244 func (fpv *ActivityLogEvent_FieldTerminalPathValue) CompareWith(source *ActivityLog_Event) (int, bool) { 2245 switch fpv.selector { 2246 case ActivityLogEvent_FieldPathSelectorClientMessage: 2247 return 0, false 2248 case ActivityLogEvent_FieldPathSelectorServerMessage: 2249 return 0, false 2250 case ActivityLogEvent_FieldPathSelectorExit: 2251 return 0, false 2252 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 2253 return 0, false 2254 case ActivityLogEvent_FieldPathSelectorRegionalExit: 2255 return 0, false 2256 default: 2257 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fpv.selector)) 2258 } 2259 } 2260 2261 func (fpv *ActivityLogEvent_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2262 return fpv.CompareWith(source.(*ActivityLog_Event)) 2263 } 2264 2265 type ActivityLogEvent_FieldSubPathValue struct { 2266 ActivityLogEvent_FieldPath 2267 subPathValue gotenobject.FieldPathValue 2268 } 2269 2270 var _ ActivityLogEvent_FieldPathValue = (*ActivityLogEvent_FieldSubPathValue)(nil) 2271 2272 func (fpvs *ActivityLogEvent_FieldSubPathValue) AsClientMessagePathValue() (ActivityLogEventClientMsgEvent_FieldPathValue, bool) { 2273 res, ok := fpvs.subPathValue.(ActivityLogEventClientMsgEvent_FieldPathValue) 2274 return res, ok 2275 } 2276 func (fpvs *ActivityLogEvent_FieldSubPathValue) AsServerMessagePathValue() (ActivityLogEventServerMsgEvent_FieldPathValue, bool) { 2277 res, ok := fpvs.subPathValue.(ActivityLogEventServerMsgEvent_FieldPathValue) 2278 return res, ok 2279 } 2280 func (fpvs *ActivityLogEvent_FieldSubPathValue) AsExitPathValue() (ActivityLogEventExitEvent_FieldPathValue, bool) { 2281 res, ok := fpvs.subPathValue.(ActivityLogEventExitEvent_FieldPathValue) 2282 return res, ok 2283 } 2284 func (fpvs *ActivityLogEvent_FieldSubPathValue) AsRegionalServerMessagePathValue() (ActivityLogEventRegionalServerMsgEvent_FieldPathValue, bool) { 2285 res, ok := fpvs.subPathValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathValue) 2286 return res, ok 2287 } 2288 func (fpvs *ActivityLogEvent_FieldSubPathValue) AsRegionalExitPathValue() (ActivityLogEventRegionalServerMsgEvent_FieldPathValue, bool) { 2289 res, ok := fpvs.subPathValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathValue) 2290 return res, ok 2291 } 2292 2293 func (fpvs *ActivityLogEvent_FieldSubPathValue) SetTo(target **ActivityLog_Event) { 2294 if *target == nil { 2295 *target = new(ActivityLog_Event) 2296 } 2297 switch fpvs.Selector() { 2298 case ActivityLogEvent_FieldPathSelectorClientMessage: 2299 if _, ok := (*target).Evt.(*ActivityLog_Event_ClientMessage); !ok { 2300 (*target).Evt = &ActivityLog_Event_ClientMessage{} 2301 } 2302 fpvs.subPathValue.(ActivityLogEventClientMsgEvent_FieldPathValue).SetTo(&(*target).Evt.(*ActivityLog_Event_ClientMessage).ClientMessage) 2303 case ActivityLogEvent_FieldPathSelectorServerMessage: 2304 if _, ok := (*target).Evt.(*ActivityLog_Event_ServerMessage); !ok { 2305 (*target).Evt = &ActivityLog_Event_ServerMessage{} 2306 } 2307 fpvs.subPathValue.(ActivityLogEventServerMsgEvent_FieldPathValue).SetTo(&(*target).Evt.(*ActivityLog_Event_ServerMessage).ServerMessage) 2308 case ActivityLogEvent_FieldPathSelectorExit: 2309 if _, ok := (*target).Evt.(*ActivityLog_Event_Exit); !ok { 2310 (*target).Evt = &ActivityLog_Event_Exit{} 2311 } 2312 fpvs.subPathValue.(ActivityLogEventExitEvent_FieldPathValue).SetTo(&(*target).Evt.(*ActivityLog_Event_Exit).Exit) 2313 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 2314 if _, ok := (*target).Evt.(*ActivityLog_Event_RegionalServerMessage); !ok { 2315 (*target).Evt = &ActivityLog_Event_RegionalServerMessage{} 2316 } 2317 fpvs.subPathValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathValue).SetTo(&(*target).Evt.(*ActivityLog_Event_RegionalServerMessage).RegionalServerMessage) 2318 case ActivityLogEvent_FieldPathSelectorRegionalExit: 2319 if _, ok := (*target).Evt.(*ActivityLog_Event_RegionalExit); !ok { 2320 (*target).Evt = &ActivityLog_Event_RegionalExit{} 2321 } 2322 fpvs.subPathValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathValue).SetTo(&(*target).Evt.(*ActivityLog_Event_RegionalExit).RegionalExit) 2323 default: 2324 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fpvs.Selector())) 2325 } 2326 } 2327 2328 func (fpvs *ActivityLogEvent_FieldSubPathValue) SetToRaw(target proto.Message) { 2329 typedObject := target.(*ActivityLog_Event) 2330 fpvs.SetTo(&typedObject) 2331 } 2332 2333 func (fpvs *ActivityLogEvent_FieldSubPathValue) GetRawValue() interface{} { 2334 return fpvs.subPathValue.GetRawValue() 2335 } 2336 2337 func (fpvs *ActivityLogEvent_FieldSubPathValue) CompareWith(source *ActivityLog_Event) (int, bool) { 2338 switch fpvs.Selector() { 2339 case ActivityLogEvent_FieldPathSelectorClientMessage: 2340 return fpvs.subPathValue.(ActivityLogEventClientMsgEvent_FieldPathValue).CompareWith(source.GetClientMessage()) 2341 case ActivityLogEvent_FieldPathSelectorServerMessage: 2342 return fpvs.subPathValue.(ActivityLogEventServerMsgEvent_FieldPathValue).CompareWith(source.GetServerMessage()) 2343 case ActivityLogEvent_FieldPathSelectorExit: 2344 return fpvs.subPathValue.(ActivityLogEventExitEvent_FieldPathValue).CompareWith(source.GetExit()) 2345 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 2346 return fpvs.subPathValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathValue).CompareWith(source.GetRegionalServerMessage()) 2347 case ActivityLogEvent_FieldPathSelectorRegionalExit: 2348 return fpvs.subPathValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathValue).CompareWith(source.GetRegionalExit()) 2349 default: 2350 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fpvs.Selector())) 2351 } 2352 } 2353 2354 func (fpvs *ActivityLogEvent_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2355 return fpvs.CompareWith(source.(*ActivityLog_Event)) 2356 } 2357 2358 // ActivityLogEvent_FieldPathArrayItemValue allows storing single item in Path-specific values for Event according to their type 2359 // Present only for array (repeated) types. 2360 type ActivityLogEvent_FieldPathArrayItemValue interface { 2361 gotenobject.FieldPathArrayItemValue 2362 ActivityLogEvent_FieldPath 2363 ContainsValue(*ActivityLog_Event) bool 2364 } 2365 2366 // ParseActivityLogEvent_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2367 func ParseActivityLogEvent_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogEvent_FieldPathArrayItemValue, error) { 2368 fp, err := ParseActivityLogEvent_FieldPath(pathStr) 2369 if err != nil { 2370 return nil, err 2371 } 2372 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2373 if err != nil { 2374 return nil, status.Errorf(codes.InvalidArgument, "error parsing Event field path array item value from %s: %v", valueStr, err) 2375 } 2376 return fpaiv.(ActivityLogEvent_FieldPathArrayItemValue), nil 2377 } 2378 2379 func MustParseActivityLogEvent_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogEvent_FieldPathArrayItemValue { 2380 fpaiv, err := ParseActivityLogEvent_FieldPathArrayItemValue(pathStr, valueStr) 2381 if err != nil { 2382 panic(err) 2383 } 2384 return fpaiv 2385 } 2386 2387 type ActivityLogEvent_FieldTerminalPathArrayItemValue struct { 2388 ActivityLogEvent_FieldTerminalPath 2389 value interface{} 2390 } 2391 2392 var _ ActivityLogEvent_FieldPathArrayItemValue = (*ActivityLogEvent_FieldTerminalPathArrayItemValue)(nil) 2393 2394 // GetRawValue returns stored element value for array in object ActivityLog_Event as interface{} 2395 func (fpaiv *ActivityLogEvent_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2396 return fpaiv.value 2397 } 2398 2399 func (fpaiv *ActivityLogEvent_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_Event) (interface{}, bool) { 2400 return nil, false 2401 } 2402 2403 func (fpaiv *ActivityLogEvent_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2404 return fpaiv.GetSingle(source.(*ActivityLog_Event)) 2405 } 2406 2407 // Contains returns a boolean indicating if value that is being held is present in given 'Event' 2408 func (fpaiv *ActivityLogEvent_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_Event) bool { 2409 slice := fpaiv.ActivityLogEvent_FieldTerminalPath.Get(source) 2410 for _, v := range slice { 2411 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2412 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2413 return true 2414 } 2415 } else if reflect.DeepEqual(v, fpaiv.value) { 2416 return true 2417 } 2418 } 2419 return false 2420 } 2421 2422 type ActivityLogEvent_FieldSubPathArrayItemValue struct { 2423 ActivityLogEvent_FieldPath 2424 subPathItemValue gotenobject.FieldPathArrayItemValue 2425 } 2426 2427 // GetRawValue returns stored array item value 2428 func (fpaivs *ActivityLogEvent_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 2429 return fpaivs.subPathItemValue.GetRawItemValue() 2430 } 2431 func (fpaivs *ActivityLogEvent_FieldSubPathArrayItemValue) AsClientMessagePathItemValue() (ActivityLogEventClientMsgEvent_FieldPathArrayItemValue, bool) { 2432 res, ok := fpaivs.subPathItemValue.(ActivityLogEventClientMsgEvent_FieldPathArrayItemValue) 2433 return res, ok 2434 } 2435 func (fpaivs *ActivityLogEvent_FieldSubPathArrayItemValue) AsServerMessagePathItemValue() (ActivityLogEventServerMsgEvent_FieldPathArrayItemValue, bool) { 2436 res, ok := fpaivs.subPathItemValue.(ActivityLogEventServerMsgEvent_FieldPathArrayItemValue) 2437 return res, ok 2438 } 2439 func (fpaivs *ActivityLogEvent_FieldSubPathArrayItemValue) AsExitPathItemValue() (ActivityLogEventExitEvent_FieldPathArrayItemValue, bool) { 2440 res, ok := fpaivs.subPathItemValue.(ActivityLogEventExitEvent_FieldPathArrayItemValue) 2441 return res, ok 2442 } 2443 func (fpaivs *ActivityLogEvent_FieldSubPathArrayItemValue) AsRegionalServerMessagePathItemValue() (ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue, bool) { 2444 res, ok := fpaivs.subPathItemValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue) 2445 return res, ok 2446 } 2447 func (fpaivs *ActivityLogEvent_FieldSubPathArrayItemValue) AsRegionalExitPathItemValue() (ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue, bool) { 2448 res, ok := fpaivs.subPathItemValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue) 2449 return res, ok 2450 } 2451 2452 // Contains returns a boolean indicating if value that is being held is present in given 'Event' 2453 func (fpaivs *ActivityLogEvent_FieldSubPathArrayItemValue) ContainsValue(source *ActivityLog_Event) bool { 2454 switch fpaivs.Selector() { 2455 case ActivityLogEvent_FieldPathSelectorClientMessage: 2456 return fpaivs.subPathItemValue.(ActivityLogEventClientMsgEvent_FieldPathArrayItemValue).ContainsValue(source.GetClientMessage()) 2457 case ActivityLogEvent_FieldPathSelectorServerMessage: 2458 return fpaivs.subPathItemValue.(ActivityLogEventServerMsgEvent_FieldPathArrayItemValue).ContainsValue(source.GetServerMessage()) 2459 case ActivityLogEvent_FieldPathSelectorExit: 2460 return fpaivs.subPathItemValue.(ActivityLogEventExitEvent_FieldPathArrayItemValue).ContainsValue(source.GetExit()) 2461 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 2462 return fpaivs.subPathItemValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue).ContainsValue(source.GetRegionalServerMessage()) 2463 case ActivityLogEvent_FieldPathSelectorRegionalExit: 2464 return fpaivs.subPathItemValue.(ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue).ContainsValue(source.GetRegionalExit()) 2465 default: 2466 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event: %d", fpaivs.Selector())) 2467 } 2468 } 2469 2470 // ActivityLogEvent_FieldPathArrayOfValues allows storing slice of values for Event fields according to their type 2471 type ActivityLogEvent_FieldPathArrayOfValues interface { 2472 gotenobject.FieldPathArrayOfValues 2473 ActivityLogEvent_FieldPath 2474 } 2475 2476 func ParseActivityLogEvent_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogEvent_FieldPathArrayOfValues, error) { 2477 fp, err := ParseActivityLogEvent_FieldPath(pathStr) 2478 if err != nil { 2479 return nil, err 2480 } 2481 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2482 if err != nil { 2483 return nil, status.Errorf(codes.InvalidArgument, "error parsing Event field path array of values from %s: %v", valuesStr, err) 2484 } 2485 return fpaov.(ActivityLogEvent_FieldPathArrayOfValues), nil 2486 } 2487 2488 func MustParseActivityLogEvent_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogEvent_FieldPathArrayOfValues { 2489 fpaov, err := ParseActivityLogEvent_FieldPathArrayOfValues(pathStr, valuesStr) 2490 if err != nil { 2491 panic(err) 2492 } 2493 return fpaov 2494 } 2495 2496 type ActivityLogEvent_FieldTerminalPathArrayOfValues struct { 2497 ActivityLogEvent_FieldTerminalPath 2498 values interface{} 2499 } 2500 2501 var _ ActivityLogEvent_FieldPathArrayOfValues = (*ActivityLogEvent_FieldTerminalPathArrayOfValues)(nil) 2502 2503 func (fpaov *ActivityLogEvent_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2504 switch fpaov.selector { 2505 case ActivityLogEvent_FieldPathSelectorClientMessage: 2506 for _, v := range fpaov.values.([]*ActivityLog_Event_ClientMsgEvent) { 2507 values = append(values, v) 2508 } 2509 case ActivityLogEvent_FieldPathSelectorServerMessage: 2510 for _, v := range fpaov.values.([]*ActivityLog_Event_ServerMsgEvent) { 2511 values = append(values, v) 2512 } 2513 case ActivityLogEvent_FieldPathSelectorExit: 2514 for _, v := range fpaov.values.([]*ActivityLog_Event_ExitEvent) { 2515 values = append(values, v) 2516 } 2517 case ActivityLogEvent_FieldPathSelectorRegionalServerMessage: 2518 for _, v := range fpaov.values.([]*ActivityLog_Event_RegionalServerMsgEvent) { 2519 values = append(values, v) 2520 } 2521 case ActivityLogEvent_FieldPathSelectorRegionalExit: 2522 for _, v := range fpaov.values.([]*ActivityLog_Event_RegionalServerMsgEvent) { 2523 values = append(values, v) 2524 } 2525 } 2526 return 2527 } 2528 func (fpaov *ActivityLogEvent_FieldTerminalPathArrayOfValues) AsClientMessageArrayOfValues() ([]*ActivityLog_Event_ClientMsgEvent, bool) { 2529 res, ok := fpaov.values.([]*ActivityLog_Event_ClientMsgEvent) 2530 return res, ok 2531 } 2532 func (fpaov *ActivityLogEvent_FieldTerminalPathArrayOfValues) AsServerMessageArrayOfValues() ([]*ActivityLog_Event_ServerMsgEvent, bool) { 2533 res, ok := fpaov.values.([]*ActivityLog_Event_ServerMsgEvent) 2534 return res, ok 2535 } 2536 func (fpaov *ActivityLogEvent_FieldTerminalPathArrayOfValues) AsExitArrayOfValues() ([]*ActivityLog_Event_ExitEvent, bool) { 2537 res, ok := fpaov.values.([]*ActivityLog_Event_ExitEvent) 2538 return res, ok 2539 } 2540 func (fpaov *ActivityLogEvent_FieldTerminalPathArrayOfValues) AsRegionalServerMessageArrayOfValues() ([]*ActivityLog_Event_RegionalServerMsgEvent, bool) { 2541 res, ok := fpaov.values.([]*ActivityLog_Event_RegionalServerMsgEvent) 2542 return res, ok 2543 } 2544 func (fpaov *ActivityLogEvent_FieldTerminalPathArrayOfValues) AsRegionalExitArrayOfValues() ([]*ActivityLog_Event_RegionalServerMsgEvent, bool) { 2545 res, ok := fpaov.values.([]*ActivityLog_Event_RegionalServerMsgEvent) 2546 return res, ok 2547 } 2548 2549 type ActivityLogEvent_FieldSubPathArrayOfValues struct { 2550 ActivityLogEvent_FieldPath 2551 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 2552 } 2553 2554 var _ ActivityLogEvent_FieldPathArrayOfValues = (*ActivityLogEvent_FieldSubPathArrayOfValues)(nil) 2555 2556 func (fpsaov *ActivityLogEvent_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 2557 return fpsaov.subPathArrayOfValues.GetRawValues() 2558 } 2559 func (fpsaov *ActivityLogEvent_FieldSubPathArrayOfValues) AsClientMessagePathArrayOfValues() (ActivityLogEventClientMsgEvent_FieldPathArrayOfValues, bool) { 2560 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogEventClientMsgEvent_FieldPathArrayOfValues) 2561 return res, ok 2562 } 2563 func (fpsaov *ActivityLogEvent_FieldSubPathArrayOfValues) AsServerMessagePathArrayOfValues() (ActivityLogEventServerMsgEvent_FieldPathArrayOfValues, bool) { 2564 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogEventServerMsgEvent_FieldPathArrayOfValues) 2565 return res, ok 2566 } 2567 func (fpsaov *ActivityLogEvent_FieldSubPathArrayOfValues) AsExitPathArrayOfValues() (ActivityLogEventExitEvent_FieldPathArrayOfValues, bool) { 2568 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogEventExitEvent_FieldPathArrayOfValues) 2569 return res, ok 2570 } 2571 func (fpsaov *ActivityLogEvent_FieldSubPathArrayOfValues) AsRegionalServerMessagePathArrayOfValues() (ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues, bool) { 2572 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues) 2573 return res, ok 2574 } 2575 func (fpsaov *ActivityLogEvent_FieldSubPathArrayOfValues) AsRegionalExitPathArrayOfValues() (ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues, bool) { 2576 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues) 2577 return res, ok 2578 } 2579 2580 // FieldPath provides implementation to handle 2581 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 2582 type ActivityLogMethod_FieldPath interface { 2583 gotenobject.FieldPath 2584 Selector() ActivityLogMethod_FieldPathSelector 2585 Get(source *ActivityLog_Method) []interface{} 2586 GetSingle(source *ActivityLog_Method) (interface{}, bool) 2587 ClearValue(item *ActivityLog_Method) 2588 2589 // Those methods build corresponding ActivityLogMethod_FieldPathValue 2590 // (or array of values) and holds passed value. Panics if injected type is incorrect. 2591 WithIValue(value interface{}) ActivityLogMethod_FieldPathValue 2592 WithIArrayOfValues(values interface{}) ActivityLogMethod_FieldPathArrayOfValues 2593 WithIArrayItemValue(value interface{}) ActivityLogMethod_FieldPathArrayItemValue 2594 } 2595 2596 type ActivityLogMethod_FieldPathSelector int32 2597 2598 const ( 2599 ActivityLogMethod_FieldPathSelectorType ActivityLogMethod_FieldPathSelector = 0 2600 ActivityLogMethod_FieldPathSelectorVersion ActivityLogMethod_FieldPathSelector = 1 2601 ) 2602 2603 func (s ActivityLogMethod_FieldPathSelector) String() string { 2604 switch s { 2605 case ActivityLogMethod_FieldPathSelectorType: 2606 return "type" 2607 case ActivityLogMethod_FieldPathSelectorVersion: 2608 return "version" 2609 default: 2610 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", s)) 2611 } 2612 } 2613 2614 func BuildActivityLogMethod_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogMethod_FieldPath, error) { 2615 if len(fp) == 0 { 2616 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_Method") 2617 } 2618 if len(fp) == 1 { 2619 switch fp[0] { 2620 case "type": 2621 return &ActivityLogMethod_FieldTerminalPath{selector: ActivityLogMethod_FieldPathSelectorType}, nil 2622 case "version": 2623 return &ActivityLogMethod_FieldTerminalPath{selector: ActivityLogMethod_FieldPathSelectorVersion}, nil 2624 } 2625 } 2626 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_Method", fp) 2627 } 2628 2629 func ParseActivityLogMethod_FieldPath(rawField string) (ActivityLogMethod_FieldPath, error) { 2630 fp, err := gotenobject.ParseRawFieldPath(rawField) 2631 if err != nil { 2632 return nil, err 2633 } 2634 return BuildActivityLogMethod_FieldPath(fp) 2635 } 2636 2637 func MustParseActivityLogMethod_FieldPath(rawField string) ActivityLogMethod_FieldPath { 2638 fp, err := ParseActivityLogMethod_FieldPath(rawField) 2639 if err != nil { 2640 panic(err) 2641 } 2642 return fp 2643 } 2644 2645 type ActivityLogMethod_FieldTerminalPath struct { 2646 selector ActivityLogMethod_FieldPathSelector 2647 } 2648 2649 var _ ActivityLogMethod_FieldPath = (*ActivityLogMethod_FieldTerminalPath)(nil) 2650 2651 func (fp *ActivityLogMethod_FieldTerminalPath) Selector() ActivityLogMethod_FieldPathSelector { 2652 return fp.selector 2653 } 2654 2655 // String returns path representation in proto convention 2656 func (fp *ActivityLogMethod_FieldTerminalPath) String() string { 2657 return fp.selector.String() 2658 } 2659 2660 // JSONString returns path representation is JSON convention 2661 func (fp *ActivityLogMethod_FieldTerminalPath) JSONString() string { 2662 return strcase.ToLowerCamel(fp.String()) 2663 } 2664 2665 // Get returns all values pointed by specific field from source ActivityLog_Method 2666 func (fp *ActivityLogMethod_FieldTerminalPath) Get(source *ActivityLog_Method) (values []interface{}) { 2667 if source != nil { 2668 switch fp.selector { 2669 case ActivityLogMethod_FieldPathSelectorType: 2670 values = append(values, source.Type) 2671 case ActivityLogMethod_FieldPathSelectorVersion: 2672 values = append(values, source.Version) 2673 default: 2674 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", fp.selector)) 2675 } 2676 } 2677 return 2678 } 2679 2680 func (fp *ActivityLogMethod_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2681 return fp.Get(source.(*ActivityLog_Method)) 2682 } 2683 2684 // GetSingle returns value pointed by specific field of from source ActivityLog_Method 2685 func (fp *ActivityLogMethod_FieldTerminalPath) GetSingle(source *ActivityLog_Method) (interface{}, bool) { 2686 switch fp.selector { 2687 case ActivityLogMethod_FieldPathSelectorType: 2688 return source.GetType(), source != nil 2689 case ActivityLogMethod_FieldPathSelectorVersion: 2690 return source.GetVersion(), source != nil 2691 default: 2692 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", fp.selector)) 2693 } 2694 } 2695 2696 func (fp *ActivityLogMethod_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2697 return fp.GetSingle(source.(*ActivityLog_Method)) 2698 } 2699 2700 // GetDefault returns a default value of the field type 2701 func (fp *ActivityLogMethod_FieldTerminalPath) GetDefault() interface{} { 2702 switch fp.selector { 2703 case ActivityLogMethod_FieldPathSelectorType: 2704 return "" 2705 case ActivityLogMethod_FieldPathSelectorVersion: 2706 return "" 2707 default: 2708 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", fp.selector)) 2709 } 2710 } 2711 2712 func (fp *ActivityLogMethod_FieldTerminalPath) ClearValue(item *ActivityLog_Method) { 2713 if item != nil { 2714 switch fp.selector { 2715 case ActivityLogMethod_FieldPathSelectorType: 2716 item.Type = "" 2717 case ActivityLogMethod_FieldPathSelectorVersion: 2718 item.Version = "" 2719 default: 2720 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", fp.selector)) 2721 } 2722 } 2723 } 2724 2725 func (fp *ActivityLogMethod_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2726 fp.ClearValue(item.(*ActivityLog_Method)) 2727 } 2728 2729 // IsLeaf - whether field path is holds simple value 2730 func (fp *ActivityLogMethod_FieldTerminalPath) IsLeaf() bool { 2731 return fp.selector == ActivityLogMethod_FieldPathSelectorType || 2732 fp.selector == ActivityLogMethod_FieldPathSelectorVersion 2733 } 2734 2735 func (fp *ActivityLogMethod_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2736 return []gotenobject.FieldPath{fp} 2737 } 2738 2739 func (fp *ActivityLogMethod_FieldTerminalPath) WithIValue(value interface{}) ActivityLogMethod_FieldPathValue { 2740 switch fp.selector { 2741 case ActivityLogMethod_FieldPathSelectorType: 2742 return &ActivityLogMethod_FieldTerminalPathValue{ActivityLogMethod_FieldTerminalPath: *fp, value: value.(string)} 2743 case ActivityLogMethod_FieldPathSelectorVersion: 2744 return &ActivityLogMethod_FieldTerminalPathValue{ActivityLogMethod_FieldTerminalPath: *fp, value: value.(string)} 2745 default: 2746 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", fp.selector)) 2747 } 2748 } 2749 2750 func (fp *ActivityLogMethod_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2751 return fp.WithIValue(value) 2752 } 2753 2754 func (fp *ActivityLogMethod_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogMethod_FieldPathArrayOfValues { 2755 fpaov := &ActivityLogMethod_FieldTerminalPathArrayOfValues{ActivityLogMethod_FieldTerminalPath: *fp} 2756 switch fp.selector { 2757 case ActivityLogMethod_FieldPathSelectorType: 2758 return &ActivityLogMethod_FieldTerminalPathArrayOfValues{ActivityLogMethod_FieldTerminalPath: *fp, values: values.([]string)} 2759 case ActivityLogMethod_FieldPathSelectorVersion: 2760 return &ActivityLogMethod_FieldTerminalPathArrayOfValues{ActivityLogMethod_FieldTerminalPath: *fp, values: values.([]string)} 2761 default: 2762 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", fp.selector)) 2763 } 2764 return fpaov 2765 } 2766 2767 func (fp *ActivityLogMethod_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2768 return fp.WithIArrayOfValues(values) 2769 } 2770 2771 func (fp *ActivityLogMethod_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogMethod_FieldPathArrayItemValue { 2772 switch fp.selector { 2773 default: 2774 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", fp.selector)) 2775 } 2776 } 2777 2778 func (fp *ActivityLogMethod_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2779 return fp.WithIArrayItemValue(value) 2780 } 2781 2782 // ActivityLogMethod_FieldPathValue allows storing values for Method fields according to their type 2783 type ActivityLogMethod_FieldPathValue interface { 2784 ActivityLogMethod_FieldPath 2785 gotenobject.FieldPathValue 2786 SetTo(target **ActivityLog_Method) 2787 CompareWith(*ActivityLog_Method) (cmp int, comparable bool) 2788 } 2789 2790 func ParseActivityLogMethod_FieldPathValue(pathStr, valueStr string) (ActivityLogMethod_FieldPathValue, error) { 2791 fp, err := ParseActivityLogMethod_FieldPath(pathStr) 2792 if err != nil { 2793 return nil, err 2794 } 2795 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2796 if err != nil { 2797 return nil, status.Errorf(codes.InvalidArgument, "error parsing Method field path value from %s: %v", valueStr, err) 2798 } 2799 return fpv.(ActivityLogMethod_FieldPathValue), nil 2800 } 2801 2802 func MustParseActivityLogMethod_FieldPathValue(pathStr, valueStr string) ActivityLogMethod_FieldPathValue { 2803 fpv, err := ParseActivityLogMethod_FieldPathValue(pathStr, valueStr) 2804 if err != nil { 2805 panic(err) 2806 } 2807 return fpv 2808 } 2809 2810 type ActivityLogMethod_FieldTerminalPathValue struct { 2811 ActivityLogMethod_FieldTerminalPath 2812 value interface{} 2813 } 2814 2815 var _ ActivityLogMethod_FieldPathValue = (*ActivityLogMethod_FieldTerminalPathValue)(nil) 2816 2817 // GetRawValue returns raw value stored under selected path for 'Method' as interface{} 2818 func (fpv *ActivityLogMethod_FieldTerminalPathValue) GetRawValue() interface{} { 2819 return fpv.value 2820 } 2821 func (fpv *ActivityLogMethod_FieldTerminalPathValue) AsTypeValue() (string, bool) { 2822 res, ok := fpv.value.(string) 2823 return res, ok 2824 } 2825 func (fpv *ActivityLogMethod_FieldTerminalPathValue) AsVersionValue() (string, bool) { 2826 res, ok := fpv.value.(string) 2827 return res, ok 2828 } 2829 2830 // SetTo stores value for selected field for object Method 2831 func (fpv *ActivityLogMethod_FieldTerminalPathValue) SetTo(target **ActivityLog_Method) { 2832 if *target == nil { 2833 *target = new(ActivityLog_Method) 2834 } 2835 switch fpv.selector { 2836 case ActivityLogMethod_FieldPathSelectorType: 2837 (*target).Type = fpv.value.(string) 2838 case ActivityLogMethod_FieldPathSelectorVersion: 2839 (*target).Version = fpv.value.(string) 2840 default: 2841 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", fpv.selector)) 2842 } 2843 } 2844 2845 func (fpv *ActivityLogMethod_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2846 typedObject := target.(*ActivityLog_Method) 2847 fpv.SetTo(&typedObject) 2848 } 2849 2850 // CompareWith compares value in the 'ActivityLogMethod_FieldTerminalPathValue' with the value under path in 'ActivityLog_Method'. 2851 func (fpv *ActivityLogMethod_FieldTerminalPathValue) CompareWith(source *ActivityLog_Method) (int, bool) { 2852 switch fpv.selector { 2853 case ActivityLogMethod_FieldPathSelectorType: 2854 leftValue := fpv.value.(string) 2855 rightValue := source.GetType() 2856 if (leftValue) == (rightValue) { 2857 return 0, true 2858 } else if (leftValue) < (rightValue) { 2859 return -1, true 2860 } else { 2861 return 1, true 2862 } 2863 case ActivityLogMethod_FieldPathSelectorVersion: 2864 leftValue := fpv.value.(string) 2865 rightValue := source.GetVersion() 2866 if (leftValue) == (rightValue) { 2867 return 0, true 2868 } else if (leftValue) < (rightValue) { 2869 return -1, true 2870 } else { 2871 return 1, true 2872 } 2873 default: 2874 panic(fmt.Sprintf("Invalid selector for ActivityLog_Method: %d", fpv.selector)) 2875 } 2876 } 2877 2878 func (fpv *ActivityLogMethod_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2879 return fpv.CompareWith(source.(*ActivityLog_Method)) 2880 } 2881 2882 // ActivityLogMethod_FieldPathArrayItemValue allows storing single item in Path-specific values for Method according to their type 2883 // Present only for array (repeated) types. 2884 type ActivityLogMethod_FieldPathArrayItemValue interface { 2885 gotenobject.FieldPathArrayItemValue 2886 ActivityLogMethod_FieldPath 2887 ContainsValue(*ActivityLog_Method) bool 2888 } 2889 2890 // ParseActivityLogMethod_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2891 func ParseActivityLogMethod_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogMethod_FieldPathArrayItemValue, error) { 2892 fp, err := ParseActivityLogMethod_FieldPath(pathStr) 2893 if err != nil { 2894 return nil, err 2895 } 2896 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2897 if err != nil { 2898 return nil, status.Errorf(codes.InvalidArgument, "error parsing Method field path array item value from %s: %v", valueStr, err) 2899 } 2900 return fpaiv.(ActivityLogMethod_FieldPathArrayItemValue), nil 2901 } 2902 2903 func MustParseActivityLogMethod_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogMethod_FieldPathArrayItemValue { 2904 fpaiv, err := ParseActivityLogMethod_FieldPathArrayItemValue(pathStr, valueStr) 2905 if err != nil { 2906 panic(err) 2907 } 2908 return fpaiv 2909 } 2910 2911 type ActivityLogMethod_FieldTerminalPathArrayItemValue struct { 2912 ActivityLogMethod_FieldTerminalPath 2913 value interface{} 2914 } 2915 2916 var _ ActivityLogMethod_FieldPathArrayItemValue = (*ActivityLogMethod_FieldTerminalPathArrayItemValue)(nil) 2917 2918 // GetRawValue returns stored element value for array in object ActivityLog_Method as interface{} 2919 func (fpaiv *ActivityLogMethod_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2920 return fpaiv.value 2921 } 2922 2923 func (fpaiv *ActivityLogMethod_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_Method) (interface{}, bool) { 2924 return nil, false 2925 } 2926 2927 func (fpaiv *ActivityLogMethod_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2928 return fpaiv.GetSingle(source.(*ActivityLog_Method)) 2929 } 2930 2931 // Contains returns a boolean indicating if value that is being held is present in given 'Method' 2932 func (fpaiv *ActivityLogMethod_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_Method) bool { 2933 slice := fpaiv.ActivityLogMethod_FieldTerminalPath.Get(source) 2934 for _, v := range slice { 2935 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2936 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2937 return true 2938 } 2939 } else if reflect.DeepEqual(v, fpaiv.value) { 2940 return true 2941 } 2942 } 2943 return false 2944 } 2945 2946 // ActivityLogMethod_FieldPathArrayOfValues allows storing slice of values for Method fields according to their type 2947 type ActivityLogMethod_FieldPathArrayOfValues interface { 2948 gotenobject.FieldPathArrayOfValues 2949 ActivityLogMethod_FieldPath 2950 } 2951 2952 func ParseActivityLogMethod_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogMethod_FieldPathArrayOfValues, error) { 2953 fp, err := ParseActivityLogMethod_FieldPath(pathStr) 2954 if err != nil { 2955 return nil, err 2956 } 2957 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2958 if err != nil { 2959 return nil, status.Errorf(codes.InvalidArgument, "error parsing Method field path array of values from %s: %v", valuesStr, err) 2960 } 2961 return fpaov.(ActivityLogMethod_FieldPathArrayOfValues), nil 2962 } 2963 2964 func MustParseActivityLogMethod_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogMethod_FieldPathArrayOfValues { 2965 fpaov, err := ParseActivityLogMethod_FieldPathArrayOfValues(pathStr, valuesStr) 2966 if err != nil { 2967 panic(err) 2968 } 2969 return fpaov 2970 } 2971 2972 type ActivityLogMethod_FieldTerminalPathArrayOfValues struct { 2973 ActivityLogMethod_FieldTerminalPath 2974 values interface{} 2975 } 2976 2977 var _ ActivityLogMethod_FieldPathArrayOfValues = (*ActivityLogMethod_FieldTerminalPathArrayOfValues)(nil) 2978 2979 func (fpaov *ActivityLogMethod_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2980 switch fpaov.selector { 2981 case ActivityLogMethod_FieldPathSelectorType: 2982 for _, v := range fpaov.values.([]string) { 2983 values = append(values, v) 2984 } 2985 case ActivityLogMethod_FieldPathSelectorVersion: 2986 for _, v := range fpaov.values.([]string) { 2987 values = append(values, v) 2988 } 2989 } 2990 return 2991 } 2992 func (fpaov *ActivityLogMethod_FieldTerminalPathArrayOfValues) AsTypeArrayOfValues() ([]string, bool) { 2993 res, ok := fpaov.values.([]string) 2994 return res, ok 2995 } 2996 func (fpaov *ActivityLogMethod_FieldTerminalPathArrayOfValues) AsVersionArrayOfValues() ([]string, bool) { 2997 res, ok := fpaov.values.([]string) 2998 return res, ok 2999 } 3000 3001 // FieldPath provides implementation to handle 3002 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3003 type ActivityLogRequestMetadata_FieldPath interface { 3004 gotenobject.FieldPath 3005 Selector() ActivityLogRequestMetadata_FieldPathSelector 3006 Get(source *ActivityLog_RequestMetadata) []interface{} 3007 GetSingle(source *ActivityLog_RequestMetadata) (interface{}, bool) 3008 ClearValue(item *ActivityLog_RequestMetadata) 3009 3010 // Those methods build corresponding ActivityLogRequestMetadata_FieldPathValue 3011 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3012 WithIValue(value interface{}) ActivityLogRequestMetadata_FieldPathValue 3013 WithIArrayOfValues(values interface{}) ActivityLogRequestMetadata_FieldPathArrayOfValues 3014 WithIArrayItemValue(value interface{}) ActivityLogRequestMetadata_FieldPathArrayItemValue 3015 } 3016 3017 type ActivityLogRequestMetadata_FieldPathSelector int32 3018 3019 const ( 3020 ActivityLogRequestMetadata_FieldPathSelectorIpAddress ActivityLogRequestMetadata_FieldPathSelector = 0 3021 ActivityLogRequestMetadata_FieldPathSelectorUserAgent ActivityLogRequestMetadata_FieldPathSelector = 1 3022 ) 3023 3024 func (s ActivityLogRequestMetadata_FieldPathSelector) String() string { 3025 switch s { 3026 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3027 return "ip_address" 3028 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3029 return "user_agent" 3030 default: 3031 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", s)) 3032 } 3033 } 3034 3035 func BuildActivityLogRequestMetadata_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogRequestMetadata_FieldPath, error) { 3036 if len(fp) == 0 { 3037 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_RequestMetadata") 3038 } 3039 if len(fp) == 1 { 3040 switch fp[0] { 3041 case "ip_address", "ipAddress", "ip-address": 3042 return &ActivityLogRequestMetadata_FieldTerminalPath{selector: ActivityLogRequestMetadata_FieldPathSelectorIpAddress}, nil 3043 case "user_agent", "userAgent", "user-agent": 3044 return &ActivityLogRequestMetadata_FieldTerminalPath{selector: ActivityLogRequestMetadata_FieldPathSelectorUserAgent}, nil 3045 } 3046 } 3047 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_RequestMetadata", fp) 3048 } 3049 3050 func ParseActivityLogRequestMetadata_FieldPath(rawField string) (ActivityLogRequestMetadata_FieldPath, error) { 3051 fp, err := gotenobject.ParseRawFieldPath(rawField) 3052 if err != nil { 3053 return nil, err 3054 } 3055 return BuildActivityLogRequestMetadata_FieldPath(fp) 3056 } 3057 3058 func MustParseActivityLogRequestMetadata_FieldPath(rawField string) ActivityLogRequestMetadata_FieldPath { 3059 fp, err := ParseActivityLogRequestMetadata_FieldPath(rawField) 3060 if err != nil { 3061 panic(err) 3062 } 3063 return fp 3064 } 3065 3066 type ActivityLogRequestMetadata_FieldTerminalPath struct { 3067 selector ActivityLogRequestMetadata_FieldPathSelector 3068 } 3069 3070 var _ ActivityLogRequestMetadata_FieldPath = (*ActivityLogRequestMetadata_FieldTerminalPath)(nil) 3071 3072 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) Selector() ActivityLogRequestMetadata_FieldPathSelector { 3073 return fp.selector 3074 } 3075 3076 // String returns path representation in proto convention 3077 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) String() string { 3078 return fp.selector.String() 3079 } 3080 3081 // JSONString returns path representation is JSON convention 3082 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) JSONString() string { 3083 return strcase.ToLowerCamel(fp.String()) 3084 } 3085 3086 // Get returns all values pointed by specific field from source ActivityLog_RequestMetadata 3087 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) Get(source *ActivityLog_RequestMetadata) (values []interface{}) { 3088 if source != nil { 3089 switch fp.selector { 3090 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3091 values = append(values, source.IpAddress) 3092 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3093 values = append(values, source.UserAgent) 3094 default: 3095 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", fp.selector)) 3096 } 3097 } 3098 return 3099 } 3100 3101 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3102 return fp.Get(source.(*ActivityLog_RequestMetadata)) 3103 } 3104 3105 // GetSingle returns value pointed by specific field of from source ActivityLog_RequestMetadata 3106 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) GetSingle(source *ActivityLog_RequestMetadata) (interface{}, bool) { 3107 switch fp.selector { 3108 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3109 return source.GetIpAddress(), source != nil 3110 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3111 return source.GetUserAgent(), source != nil 3112 default: 3113 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", fp.selector)) 3114 } 3115 } 3116 3117 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3118 return fp.GetSingle(source.(*ActivityLog_RequestMetadata)) 3119 } 3120 3121 // GetDefault returns a default value of the field type 3122 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) GetDefault() interface{} { 3123 switch fp.selector { 3124 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3125 return "" 3126 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3127 return "" 3128 default: 3129 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", fp.selector)) 3130 } 3131 } 3132 3133 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) ClearValue(item *ActivityLog_RequestMetadata) { 3134 if item != nil { 3135 switch fp.selector { 3136 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3137 item.IpAddress = "" 3138 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3139 item.UserAgent = "" 3140 default: 3141 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", fp.selector)) 3142 } 3143 } 3144 } 3145 3146 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3147 fp.ClearValue(item.(*ActivityLog_RequestMetadata)) 3148 } 3149 3150 // IsLeaf - whether field path is holds simple value 3151 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) IsLeaf() bool { 3152 return fp.selector == ActivityLogRequestMetadata_FieldPathSelectorIpAddress || 3153 fp.selector == ActivityLogRequestMetadata_FieldPathSelectorUserAgent 3154 } 3155 3156 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3157 return []gotenobject.FieldPath{fp} 3158 } 3159 3160 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) WithIValue(value interface{}) ActivityLogRequestMetadata_FieldPathValue { 3161 switch fp.selector { 3162 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3163 return &ActivityLogRequestMetadata_FieldTerminalPathValue{ActivityLogRequestMetadata_FieldTerminalPath: *fp, value: value.(string)} 3164 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3165 return &ActivityLogRequestMetadata_FieldTerminalPathValue{ActivityLogRequestMetadata_FieldTerminalPath: *fp, value: value.(string)} 3166 default: 3167 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", fp.selector)) 3168 } 3169 } 3170 3171 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3172 return fp.WithIValue(value) 3173 } 3174 3175 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogRequestMetadata_FieldPathArrayOfValues { 3176 fpaov := &ActivityLogRequestMetadata_FieldTerminalPathArrayOfValues{ActivityLogRequestMetadata_FieldTerminalPath: *fp} 3177 switch fp.selector { 3178 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3179 return &ActivityLogRequestMetadata_FieldTerminalPathArrayOfValues{ActivityLogRequestMetadata_FieldTerminalPath: *fp, values: values.([]string)} 3180 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3181 return &ActivityLogRequestMetadata_FieldTerminalPathArrayOfValues{ActivityLogRequestMetadata_FieldTerminalPath: *fp, values: values.([]string)} 3182 default: 3183 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", fp.selector)) 3184 } 3185 return fpaov 3186 } 3187 3188 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3189 return fp.WithIArrayOfValues(values) 3190 } 3191 3192 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogRequestMetadata_FieldPathArrayItemValue { 3193 switch fp.selector { 3194 default: 3195 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", fp.selector)) 3196 } 3197 } 3198 3199 func (fp *ActivityLogRequestMetadata_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3200 return fp.WithIArrayItemValue(value) 3201 } 3202 3203 // ActivityLogRequestMetadata_FieldPathValue allows storing values for RequestMetadata fields according to their type 3204 type ActivityLogRequestMetadata_FieldPathValue interface { 3205 ActivityLogRequestMetadata_FieldPath 3206 gotenobject.FieldPathValue 3207 SetTo(target **ActivityLog_RequestMetadata) 3208 CompareWith(*ActivityLog_RequestMetadata) (cmp int, comparable bool) 3209 } 3210 3211 func ParseActivityLogRequestMetadata_FieldPathValue(pathStr, valueStr string) (ActivityLogRequestMetadata_FieldPathValue, error) { 3212 fp, err := ParseActivityLogRequestMetadata_FieldPath(pathStr) 3213 if err != nil { 3214 return nil, err 3215 } 3216 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3217 if err != nil { 3218 return nil, status.Errorf(codes.InvalidArgument, "error parsing RequestMetadata field path value from %s: %v", valueStr, err) 3219 } 3220 return fpv.(ActivityLogRequestMetadata_FieldPathValue), nil 3221 } 3222 3223 func MustParseActivityLogRequestMetadata_FieldPathValue(pathStr, valueStr string) ActivityLogRequestMetadata_FieldPathValue { 3224 fpv, err := ParseActivityLogRequestMetadata_FieldPathValue(pathStr, valueStr) 3225 if err != nil { 3226 panic(err) 3227 } 3228 return fpv 3229 } 3230 3231 type ActivityLogRequestMetadata_FieldTerminalPathValue struct { 3232 ActivityLogRequestMetadata_FieldTerminalPath 3233 value interface{} 3234 } 3235 3236 var _ ActivityLogRequestMetadata_FieldPathValue = (*ActivityLogRequestMetadata_FieldTerminalPathValue)(nil) 3237 3238 // GetRawValue returns raw value stored under selected path for 'RequestMetadata' as interface{} 3239 func (fpv *ActivityLogRequestMetadata_FieldTerminalPathValue) GetRawValue() interface{} { 3240 return fpv.value 3241 } 3242 func (fpv *ActivityLogRequestMetadata_FieldTerminalPathValue) AsIpAddressValue() (string, bool) { 3243 res, ok := fpv.value.(string) 3244 return res, ok 3245 } 3246 func (fpv *ActivityLogRequestMetadata_FieldTerminalPathValue) AsUserAgentValue() (string, bool) { 3247 res, ok := fpv.value.(string) 3248 return res, ok 3249 } 3250 3251 // SetTo stores value for selected field for object RequestMetadata 3252 func (fpv *ActivityLogRequestMetadata_FieldTerminalPathValue) SetTo(target **ActivityLog_RequestMetadata) { 3253 if *target == nil { 3254 *target = new(ActivityLog_RequestMetadata) 3255 } 3256 switch fpv.selector { 3257 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3258 (*target).IpAddress = fpv.value.(string) 3259 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3260 (*target).UserAgent = fpv.value.(string) 3261 default: 3262 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", fpv.selector)) 3263 } 3264 } 3265 3266 func (fpv *ActivityLogRequestMetadata_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3267 typedObject := target.(*ActivityLog_RequestMetadata) 3268 fpv.SetTo(&typedObject) 3269 } 3270 3271 // CompareWith compares value in the 'ActivityLogRequestMetadata_FieldTerminalPathValue' with the value under path in 'ActivityLog_RequestMetadata'. 3272 func (fpv *ActivityLogRequestMetadata_FieldTerminalPathValue) CompareWith(source *ActivityLog_RequestMetadata) (int, bool) { 3273 switch fpv.selector { 3274 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3275 leftValue := fpv.value.(string) 3276 rightValue := source.GetIpAddress() 3277 if (leftValue) == (rightValue) { 3278 return 0, true 3279 } else if (leftValue) < (rightValue) { 3280 return -1, true 3281 } else { 3282 return 1, true 3283 } 3284 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3285 leftValue := fpv.value.(string) 3286 rightValue := source.GetUserAgent() 3287 if (leftValue) == (rightValue) { 3288 return 0, true 3289 } else if (leftValue) < (rightValue) { 3290 return -1, true 3291 } else { 3292 return 1, true 3293 } 3294 default: 3295 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestMetadata: %d", fpv.selector)) 3296 } 3297 } 3298 3299 func (fpv *ActivityLogRequestMetadata_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3300 return fpv.CompareWith(source.(*ActivityLog_RequestMetadata)) 3301 } 3302 3303 // ActivityLogRequestMetadata_FieldPathArrayItemValue allows storing single item in Path-specific values for RequestMetadata according to their type 3304 // Present only for array (repeated) types. 3305 type ActivityLogRequestMetadata_FieldPathArrayItemValue interface { 3306 gotenobject.FieldPathArrayItemValue 3307 ActivityLogRequestMetadata_FieldPath 3308 ContainsValue(*ActivityLog_RequestMetadata) bool 3309 } 3310 3311 // ParseActivityLogRequestMetadata_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3312 func ParseActivityLogRequestMetadata_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogRequestMetadata_FieldPathArrayItemValue, error) { 3313 fp, err := ParseActivityLogRequestMetadata_FieldPath(pathStr) 3314 if err != nil { 3315 return nil, err 3316 } 3317 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3318 if err != nil { 3319 return nil, status.Errorf(codes.InvalidArgument, "error parsing RequestMetadata field path array item value from %s: %v", valueStr, err) 3320 } 3321 return fpaiv.(ActivityLogRequestMetadata_FieldPathArrayItemValue), nil 3322 } 3323 3324 func MustParseActivityLogRequestMetadata_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogRequestMetadata_FieldPathArrayItemValue { 3325 fpaiv, err := ParseActivityLogRequestMetadata_FieldPathArrayItemValue(pathStr, valueStr) 3326 if err != nil { 3327 panic(err) 3328 } 3329 return fpaiv 3330 } 3331 3332 type ActivityLogRequestMetadata_FieldTerminalPathArrayItemValue struct { 3333 ActivityLogRequestMetadata_FieldTerminalPath 3334 value interface{} 3335 } 3336 3337 var _ ActivityLogRequestMetadata_FieldPathArrayItemValue = (*ActivityLogRequestMetadata_FieldTerminalPathArrayItemValue)(nil) 3338 3339 // GetRawValue returns stored element value for array in object ActivityLog_RequestMetadata as interface{} 3340 func (fpaiv *ActivityLogRequestMetadata_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3341 return fpaiv.value 3342 } 3343 3344 func (fpaiv *ActivityLogRequestMetadata_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_RequestMetadata) (interface{}, bool) { 3345 return nil, false 3346 } 3347 3348 func (fpaiv *ActivityLogRequestMetadata_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3349 return fpaiv.GetSingle(source.(*ActivityLog_RequestMetadata)) 3350 } 3351 3352 // Contains returns a boolean indicating if value that is being held is present in given 'RequestMetadata' 3353 func (fpaiv *ActivityLogRequestMetadata_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_RequestMetadata) bool { 3354 slice := fpaiv.ActivityLogRequestMetadata_FieldTerminalPath.Get(source) 3355 for _, v := range slice { 3356 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3357 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3358 return true 3359 } 3360 } else if reflect.DeepEqual(v, fpaiv.value) { 3361 return true 3362 } 3363 } 3364 return false 3365 } 3366 3367 // ActivityLogRequestMetadata_FieldPathArrayOfValues allows storing slice of values for RequestMetadata fields according to their type 3368 type ActivityLogRequestMetadata_FieldPathArrayOfValues interface { 3369 gotenobject.FieldPathArrayOfValues 3370 ActivityLogRequestMetadata_FieldPath 3371 } 3372 3373 func ParseActivityLogRequestMetadata_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogRequestMetadata_FieldPathArrayOfValues, error) { 3374 fp, err := ParseActivityLogRequestMetadata_FieldPath(pathStr) 3375 if err != nil { 3376 return nil, err 3377 } 3378 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3379 if err != nil { 3380 return nil, status.Errorf(codes.InvalidArgument, "error parsing RequestMetadata field path array of values from %s: %v", valuesStr, err) 3381 } 3382 return fpaov.(ActivityLogRequestMetadata_FieldPathArrayOfValues), nil 3383 } 3384 3385 func MustParseActivityLogRequestMetadata_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogRequestMetadata_FieldPathArrayOfValues { 3386 fpaov, err := ParseActivityLogRequestMetadata_FieldPathArrayOfValues(pathStr, valuesStr) 3387 if err != nil { 3388 panic(err) 3389 } 3390 return fpaov 3391 } 3392 3393 type ActivityLogRequestMetadata_FieldTerminalPathArrayOfValues struct { 3394 ActivityLogRequestMetadata_FieldTerminalPath 3395 values interface{} 3396 } 3397 3398 var _ ActivityLogRequestMetadata_FieldPathArrayOfValues = (*ActivityLogRequestMetadata_FieldTerminalPathArrayOfValues)(nil) 3399 3400 func (fpaov *ActivityLogRequestMetadata_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3401 switch fpaov.selector { 3402 case ActivityLogRequestMetadata_FieldPathSelectorIpAddress: 3403 for _, v := range fpaov.values.([]string) { 3404 values = append(values, v) 3405 } 3406 case ActivityLogRequestMetadata_FieldPathSelectorUserAgent: 3407 for _, v := range fpaov.values.([]string) { 3408 values = append(values, v) 3409 } 3410 } 3411 return 3412 } 3413 func (fpaov *ActivityLogRequestMetadata_FieldTerminalPathArrayOfValues) AsIpAddressArrayOfValues() ([]string, bool) { 3414 res, ok := fpaov.values.([]string) 3415 return res, ok 3416 } 3417 func (fpaov *ActivityLogRequestMetadata_FieldTerminalPathArrayOfValues) AsUserAgentArrayOfValues() ([]string, bool) { 3418 res, ok := fpaov.values.([]string) 3419 return res, ok 3420 } 3421 3422 // FieldPath provides implementation to handle 3423 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3424 type ActivityLogRequestRouting_FieldPath interface { 3425 gotenobject.FieldPath 3426 Selector() ActivityLogRequestRouting_FieldPathSelector 3427 Get(source *ActivityLog_RequestRouting) []interface{} 3428 GetSingle(source *ActivityLog_RequestRouting) (interface{}, bool) 3429 ClearValue(item *ActivityLog_RequestRouting) 3430 3431 // Those methods build corresponding ActivityLogRequestRouting_FieldPathValue 3432 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3433 WithIValue(value interface{}) ActivityLogRequestRouting_FieldPathValue 3434 WithIArrayOfValues(values interface{}) ActivityLogRequestRouting_FieldPathArrayOfValues 3435 WithIArrayItemValue(value interface{}) ActivityLogRequestRouting_FieldPathArrayItemValue 3436 } 3437 3438 type ActivityLogRequestRouting_FieldPathSelector int32 3439 3440 const ( 3441 ActivityLogRequestRouting_FieldPathSelectorViaRegion ActivityLogRequestRouting_FieldPathSelector = 0 3442 ActivityLogRequestRouting_FieldPathSelectorDestRegions ActivityLogRequestRouting_FieldPathSelector = 1 3443 ) 3444 3445 func (s ActivityLogRequestRouting_FieldPathSelector) String() string { 3446 switch s { 3447 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3448 return "via_region" 3449 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3450 return "dest_regions" 3451 default: 3452 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", s)) 3453 } 3454 } 3455 3456 func BuildActivityLogRequestRouting_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogRequestRouting_FieldPath, error) { 3457 if len(fp) == 0 { 3458 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_RequestRouting") 3459 } 3460 if len(fp) == 1 { 3461 switch fp[0] { 3462 case "via_region", "viaRegion", "via-region": 3463 return &ActivityLogRequestRouting_FieldTerminalPath{selector: ActivityLogRequestRouting_FieldPathSelectorViaRegion}, nil 3464 case "dest_regions", "destRegions", "dest-regions": 3465 return &ActivityLogRequestRouting_FieldTerminalPath{selector: ActivityLogRequestRouting_FieldPathSelectorDestRegions}, nil 3466 } 3467 } 3468 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_RequestRouting", fp) 3469 } 3470 3471 func ParseActivityLogRequestRouting_FieldPath(rawField string) (ActivityLogRequestRouting_FieldPath, error) { 3472 fp, err := gotenobject.ParseRawFieldPath(rawField) 3473 if err != nil { 3474 return nil, err 3475 } 3476 return BuildActivityLogRequestRouting_FieldPath(fp) 3477 } 3478 3479 func MustParseActivityLogRequestRouting_FieldPath(rawField string) ActivityLogRequestRouting_FieldPath { 3480 fp, err := ParseActivityLogRequestRouting_FieldPath(rawField) 3481 if err != nil { 3482 panic(err) 3483 } 3484 return fp 3485 } 3486 3487 type ActivityLogRequestRouting_FieldTerminalPath struct { 3488 selector ActivityLogRequestRouting_FieldPathSelector 3489 } 3490 3491 var _ ActivityLogRequestRouting_FieldPath = (*ActivityLogRequestRouting_FieldTerminalPath)(nil) 3492 3493 func (fp *ActivityLogRequestRouting_FieldTerminalPath) Selector() ActivityLogRequestRouting_FieldPathSelector { 3494 return fp.selector 3495 } 3496 3497 // String returns path representation in proto convention 3498 func (fp *ActivityLogRequestRouting_FieldTerminalPath) String() string { 3499 return fp.selector.String() 3500 } 3501 3502 // JSONString returns path representation is JSON convention 3503 func (fp *ActivityLogRequestRouting_FieldTerminalPath) JSONString() string { 3504 return strcase.ToLowerCamel(fp.String()) 3505 } 3506 3507 // Get returns all values pointed by specific field from source ActivityLog_RequestRouting 3508 func (fp *ActivityLogRequestRouting_FieldTerminalPath) Get(source *ActivityLog_RequestRouting) (values []interface{}) { 3509 if source != nil { 3510 switch fp.selector { 3511 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3512 values = append(values, source.ViaRegion) 3513 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3514 for _, value := range source.GetDestRegions() { 3515 values = append(values, value) 3516 } 3517 default: 3518 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", fp.selector)) 3519 } 3520 } 3521 return 3522 } 3523 3524 func (fp *ActivityLogRequestRouting_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3525 return fp.Get(source.(*ActivityLog_RequestRouting)) 3526 } 3527 3528 // GetSingle returns value pointed by specific field of from source ActivityLog_RequestRouting 3529 func (fp *ActivityLogRequestRouting_FieldTerminalPath) GetSingle(source *ActivityLog_RequestRouting) (interface{}, bool) { 3530 switch fp.selector { 3531 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3532 return source.GetViaRegion(), source != nil 3533 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3534 res := source.GetDestRegions() 3535 return res, res != nil 3536 default: 3537 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", fp.selector)) 3538 } 3539 } 3540 3541 func (fp *ActivityLogRequestRouting_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3542 return fp.GetSingle(source.(*ActivityLog_RequestRouting)) 3543 } 3544 3545 // GetDefault returns a default value of the field type 3546 func (fp *ActivityLogRequestRouting_FieldTerminalPath) GetDefault() interface{} { 3547 switch fp.selector { 3548 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3549 return "" 3550 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3551 return ([]string)(nil) 3552 default: 3553 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", fp.selector)) 3554 } 3555 } 3556 3557 func (fp *ActivityLogRequestRouting_FieldTerminalPath) ClearValue(item *ActivityLog_RequestRouting) { 3558 if item != nil { 3559 switch fp.selector { 3560 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3561 item.ViaRegion = "" 3562 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3563 item.DestRegions = nil 3564 default: 3565 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", fp.selector)) 3566 } 3567 } 3568 } 3569 3570 func (fp *ActivityLogRequestRouting_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3571 fp.ClearValue(item.(*ActivityLog_RequestRouting)) 3572 } 3573 3574 // IsLeaf - whether field path is holds simple value 3575 func (fp *ActivityLogRequestRouting_FieldTerminalPath) IsLeaf() bool { 3576 return fp.selector == ActivityLogRequestRouting_FieldPathSelectorViaRegion || 3577 fp.selector == ActivityLogRequestRouting_FieldPathSelectorDestRegions 3578 } 3579 3580 func (fp *ActivityLogRequestRouting_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3581 return []gotenobject.FieldPath{fp} 3582 } 3583 3584 func (fp *ActivityLogRequestRouting_FieldTerminalPath) WithIValue(value interface{}) ActivityLogRequestRouting_FieldPathValue { 3585 switch fp.selector { 3586 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3587 return &ActivityLogRequestRouting_FieldTerminalPathValue{ActivityLogRequestRouting_FieldTerminalPath: *fp, value: value.(string)} 3588 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3589 return &ActivityLogRequestRouting_FieldTerminalPathValue{ActivityLogRequestRouting_FieldTerminalPath: *fp, value: value.([]string)} 3590 default: 3591 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", fp.selector)) 3592 } 3593 } 3594 3595 func (fp *ActivityLogRequestRouting_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3596 return fp.WithIValue(value) 3597 } 3598 3599 func (fp *ActivityLogRequestRouting_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogRequestRouting_FieldPathArrayOfValues { 3600 fpaov := &ActivityLogRequestRouting_FieldTerminalPathArrayOfValues{ActivityLogRequestRouting_FieldTerminalPath: *fp} 3601 switch fp.selector { 3602 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3603 return &ActivityLogRequestRouting_FieldTerminalPathArrayOfValues{ActivityLogRequestRouting_FieldTerminalPath: *fp, values: values.([]string)} 3604 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3605 return &ActivityLogRequestRouting_FieldTerminalPathArrayOfValues{ActivityLogRequestRouting_FieldTerminalPath: *fp, values: values.([][]string)} 3606 default: 3607 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", fp.selector)) 3608 } 3609 return fpaov 3610 } 3611 3612 func (fp *ActivityLogRequestRouting_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3613 return fp.WithIArrayOfValues(values) 3614 } 3615 3616 func (fp *ActivityLogRequestRouting_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogRequestRouting_FieldPathArrayItemValue { 3617 switch fp.selector { 3618 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3619 return &ActivityLogRequestRouting_FieldTerminalPathArrayItemValue{ActivityLogRequestRouting_FieldTerminalPath: *fp, value: value.(string)} 3620 default: 3621 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", fp.selector)) 3622 } 3623 } 3624 3625 func (fp *ActivityLogRequestRouting_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3626 return fp.WithIArrayItemValue(value) 3627 } 3628 3629 // ActivityLogRequestRouting_FieldPathValue allows storing values for RequestRouting fields according to their type 3630 type ActivityLogRequestRouting_FieldPathValue interface { 3631 ActivityLogRequestRouting_FieldPath 3632 gotenobject.FieldPathValue 3633 SetTo(target **ActivityLog_RequestRouting) 3634 CompareWith(*ActivityLog_RequestRouting) (cmp int, comparable bool) 3635 } 3636 3637 func ParseActivityLogRequestRouting_FieldPathValue(pathStr, valueStr string) (ActivityLogRequestRouting_FieldPathValue, error) { 3638 fp, err := ParseActivityLogRequestRouting_FieldPath(pathStr) 3639 if err != nil { 3640 return nil, err 3641 } 3642 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3643 if err != nil { 3644 return nil, status.Errorf(codes.InvalidArgument, "error parsing RequestRouting field path value from %s: %v", valueStr, err) 3645 } 3646 return fpv.(ActivityLogRequestRouting_FieldPathValue), nil 3647 } 3648 3649 func MustParseActivityLogRequestRouting_FieldPathValue(pathStr, valueStr string) ActivityLogRequestRouting_FieldPathValue { 3650 fpv, err := ParseActivityLogRequestRouting_FieldPathValue(pathStr, valueStr) 3651 if err != nil { 3652 panic(err) 3653 } 3654 return fpv 3655 } 3656 3657 type ActivityLogRequestRouting_FieldTerminalPathValue struct { 3658 ActivityLogRequestRouting_FieldTerminalPath 3659 value interface{} 3660 } 3661 3662 var _ ActivityLogRequestRouting_FieldPathValue = (*ActivityLogRequestRouting_FieldTerminalPathValue)(nil) 3663 3664 // GetRawValue returns raw value stored under selected path for 'RequestRouting' as interface{} 3665 func (fpv *ActivityLogRequestRouting_FieldTerminalPathValue) GetRawValue() interface{} { 3666 return fpv.value 3667 } 3668 func (fpv *ActivityLogRequestRouting_FieldTerminalPathValue) AsViaRegionValue() (string, bool) { 3669 res, ok := fpv.value.(string) 3670 return res, ok 3671 } 3672 func (fpv *ActivityLogRequestRouting_FieldTerminalPathValue) AsDestRegionsValue() ([]string, bool) { 3673 res, ok := fpv.value.([]string) 3674 return res, ok 3675 } 3676 3677 // SetTo stores value for selected field for object RequestRouting 3678 func (fpv *ActivityLogRequestRouting_FieldTerminalPathValue) SetTo(target **ActivityLog_RequestRouting) { 3679 if *target == nil { 3680 *target = new(ActivityLog_RequestRouting) 3681 } 3682 switch fpv.selector { 3683 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3684 (*target).ViaRegion = fpv.value.(string) 3685 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3686 (*target).DestRegions = fpv.value.([]string) 3687 default: 3688 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", fpv.selector)) 3689 } 3690 } 3691 3692 func (fpv *ActivityLogRequestRouting_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3693 typedObject := target.(*ActivityLog_RequestRouting) 3694 fpv.SetTo(&typedObject) 3695 } 3696 3697 // CompareWith compares value in the 'ActivityLogRequestRouting_FieldTerminalPathValue' with the value under path in 'ActivityLog_RequestRouting'. 3698 func (fpv *ActivityLogRequestRouting_FieldTerminalPathValue) CompareWith(source *ActivityLog_RequestRouting) (int, bool) { 3699 switch fpv.selector { 3700 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3701 leftValue := fpv.value.(string) 3702 rightValue := source.GetViaRegion() 3703 if (leftValue) == (rightValue) { 3704 return 0, true 3705 } else if (leftValue) < (rightValue) { 3706 return -1, true 3707 } else { 3708 return 1, true 3709 } 3710 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3711 return 0, false 3712 default: 3713 panic(fmt.Sprintf("Invalid selector for ActivityLog_RequestRouting: %d", fpv.selector)) 3714 } 3715 } 3716 3717 func (fpv *ActivityLogRequestRouting_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3718 return fpv.CompareWith(source.(*ActivityLog_RequestRouting)) 3719 } 3720 3721 // ActivityLogRequestRouting_FieldPathArrayItemValue allows storing single item in Path-specific values for RequestRouting according to their type 3722 // Present only for array (repeated) types. 3723 type ActivityLogRequestRouting_FieldPathArrayItemValue interface { 3724 gotenobject.FieldPathArrayItemValue 3725 ActivityLogRequestRouting_FieldPath 3726 ContainsValue(*ActivityLog_RequestRouting) bool 3727 } 3728 3729 // ParseActivityLogRequestRouting_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3730 func ParseActivityLogRequestRouting_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogRequestRouting_FieldPathArrayItemValue, error) { 3731 fp, err := ParseActivityLogRequestRouting_FieldPath(pathStr) 3732 if err != nil { 3733 return nil, err 3734 } 3735 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3736 if err != nil { 3737 return nil, status.Errorf(codes.InvalidArgument, "error parsing RequestRouting field path array item value from %s: %v", valueStr, err) 3738 } 3739 return fpaiv.(ActivityLogRequestRouting_FieldPathArrayItemValue), nil 3740 } 3741 3742 func MustParseActivityLogRequestRouting_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogRequestRouting_FieldPathArrayItemValue { 3743 fpaiv, err := ParseActivityLogRequestRouting_FieldPathArrayItemValue(pathStr, valueStr) 3744 if err != nil { 3745 panic(err) 3746 } 3747 return fpaiv 3748 } 3749 3750 type ActivityLogRequestRouting_FieldTerminalPathArrayItemValue struct { 3751 ActivityLogRequestRouting_FieldTerminalPath 3752 value interface{} 3753 } 3754 3755 var _ ActivityLogRequestRouting_FieldPathArrayItemValue = (*ActivityLogRequestRouting_FieldTerminalPathArrayItemValue)(nil) 3756 3757 // GetRawValue returns stored element value for array in object ActivityLog_RequestRouting as interface{} 3758 func (fpaiv *ActivityLogRequestRouting_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3759 return fpaiv.value 3760 } 3761 func (fpaiv *ActivityLogRequestRouting_FieldTerminalPathArrayItemValue) AsDestRegionsItemValue() (string, bool) { 3762 res, ok := fpaiv.value.(string) 3763 return res, ok 3764 } 3765 3766 func (fpaiv *ActivityLogRequestRouting_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_RequestRouting) (interface{}, bool) { 3767 return nil, false 3768 } 3769 3770 func (fpaiv *ActivityLogRequestRouting_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3771 return fpaiv.GetSingle(source.(*ActivityLog_RequestRouting)) 3772 } 3773 3774 // Contains returns a boolean indicating if value that is being held is present in given 'RequestRouting' 3775 func (fpaiv *ActivityLogRequestRouting_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_RequestRouting) bool { 3776 slice := fpaiv.ActivityLogRequestRouting_FieldTerminalPath.Get(source) 3777 for _, v := range slice { 3778 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3779 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3780 return true 3781 } 3782 } else if reflect.DeepEqual(v, fpaiv.value) { 3783 return true 3784 } 3785 } 3786 return false 3787 } 3788 3789 // ActivityLogRequestRouting_FieldPathArrayOfValues allows storing slice of values for RequestRouting fields according to their type 3790 type ActivityLogRequestRouting_FieldPathArrayOfValues interface { 3791 gotenobject.FieldPathArrayOfValues 3792 ActivityLogRequestRouting_FieldPath 3793 } 3794 3795 func ParseActivityLogRequestRouting_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogRequestRouting_FieldPathArrayOfValues, error) { 3796 fp, err := ParseActivityLogRequestRouting_FieldPath(pathStr) 3797 if err != nil { 3798 return nil, err 3799 } 3800 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3801 if err != nil { 3802 return nil, status.Errorf(codes.InvalidArgument, "error parsing RequestRouting field path array of values from %s: %v", valuesStr, err) 3803 } 3804 return fpaov.(ActivityLogRequestRouting_FieldPathArrayOfValues), nil 3805 } 3806 3807 func MustParseActivityLogRequestRouting_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogRequestRouting_FieldPathArrayOfValues { 3808 fpaov, err := ParseActivityLogRequestRouting_FieldPathArrayOfValues(pathStr, valuesStr) 3809 if err != nil { 3810 panic(err) 3811 } 3812 return fpaov 3813 } 3814 3815 type ActivityLogRequestRouting_FieldTerminalPathArrayOfValues struct { 3816 ActivityLogRequestRouting_FieldTerminalPath 3817 values interface{} 3818 } 3819 3820 var _ ActivityLogRequestRouting_FieldPathArrayOfValues = (*ActivityLogRequestRouting_FieldTerminalPathArrayOfValues)(nil) 3821 3822 func (fpaov *ActivityLogRequestRouting_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3823 switch fpaov.selector { 3824 case ActivityLogRequestRouting_FieldPathSelectorViaRegion: 3825 for _, v := range fpaov.values.([]string) { 3826 values = append(values, v) 3827 } 3828 case ActivityLogRequestRouting_FieldPathSelectorDestRegions: 3829 for _, v := range fpaov.values.([][]string) { 3830 values = append(values, v) 3831 } 3832 } 3833 return 3834 } 3835 func (fpaov *ActivityLogRequestRouting_FieldTerminalPathArrayOfValues) AsViaRegionArrayOfValues() ([]string, bool) { 3836 res, ok := fpaov.values.([]string) 3837 return res, ok 3838 } 3839 func (fpaov *ActivityLogRequestRouting_FieldTerminalPathArrayOfValues) AsDestRegionsArrayOfValues() ([][]string, bool) { 3840 res, ok := fpaov.values.([][]string) 3841 return res, ok 3842 } 3843 3844 // FieldPath provides implementation to handle 3845 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3846 type ActivityLogResource_FieldPath interface { 3847 gotenobject.FieldPath 3848 Selector() ActivityLogResource_FieldPathSelector 3849 Get(source *ActivityLog_Resource) []interface{} 3850 GetSingle(source *ActivityLog_Resource) (interface{}, bool) 3851 ClearValue(item *ActivityLog_Resource) 3852 3853 // Those methods build corresponding ActivityLogResource_FieldPathValue 3854 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3855 WithIValue(value interface{}) ActivityLogResource_FieldPathValue 3856 WithIArrayOfValues(values interface{}) ActivityLogResource_FieldPathArrayOfValues 3857 WithIArrayItemValue(value interface{}) ActivityLogResource_FieldPathArrayItemValue 3858 } 3859 3860 type ActivityLogResource_FieldPathSelector int32 3861 3862 const ( 3863 ActivityLogResource_FieldPathSelectorName ActivityLogResource_FieldPathSelector = 0 3864 ActivityLogResource_FieldPathSelectorDifference ActivityLogResource_FieldPathSelector = 1 3865 ) 3866 3867 func (s ActivityLogResource_FieldPathSelector) String() string { 3868 switch s { 3869 case ActivityLogResource_FieldPathSelectorName: 3870 return "name" 3871 case ActivityLogResource_FieldPathSelectorDifference: 3872 return "difference" 3873 default: 3874 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", s)) 3875 } 3876 } 3877 3878 func BuildActivityLogResource_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogResource_FieldPath, error) { 3879 if len(fp) == 0 { 3880 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_Resource") 3881 } 3882 if len(fp) == 1 { 3883 switch fp[0] { 3884 case "name": 3885 return &ActivityLogResource_FieldTerminalPath{selector: ActivityLogResource_FieldPathSelectorName}, nil 3886 case "difference": 3887 return &ActivityLogResource_FieldTerminalPath{selector: ActivityLogResource_FieldPathSelectorDifference}, nil 3888 } 3889 } else { 3890 switch fp[0] { 3891 case "difference": 3892 if subpath, err := BuildActivityLogResourceDifference_FieldPath(fp[1:]); err != nil { 3893 return nil, err 3894 } else { 3895 return &ActivityLogResource_FieldSubPath{selector: ActivityLogResource_FieldPathSelectorDifference, subPath: subpath}, nil 3896 } 3897 } 3898 } 3899 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_Resource", fp) 3900 } 3901 3902 func ParseActivityLogResource_FieldPath(rawField string) (ActivityLogResource_FieldPath, error) { 3903 fp, err := gotenobject.ParseRawFieldPath(rawField) 3904 if err != nil { 3905 return nil, err 3906 } 3907 return BuildActivityLogResource_FieldPath(fp) 3908 } 3909 3910 func MustParseActivityLogResource_FieldPath(rawField string) ActivityLogResource_FieldPath { 3911 fp, err := ParseActivityLogResource_FieldPath(rawField) 3912 if err != nil { 3913 panic(err) 3914 } 3915 return fp 3916 } 3917 3918 type ActivityLogResource_FieldTerminalPath struct { 3919 selector ActivityLogResource_FieldPathSelector 3920 } 3921 3922 var _ ActivityLogResource_FieldPath = (*ActivityLogResource_FieldTerminalPath)(nil) 3923 3924 func (fp *ActivityLogResource_FieldTerminalPath) Selector() ActivityLogResource_FieldPathSelector { 3925 return fp.selector 3926 } 3927 3928 // String returns path representation in proto convention 3929 func (fp *ActivityLogResource_FieldTerminalPath) String() string { 3930 return fp.selector.String() 3931 } 3932 3933 // JSONString returns path representation is JSON convention 3934 func (fp *ActivityLogResource_FieldTerminalPath) JSONString() string { 3935 return strcase.ToLowerCamel(fp.String()) 3936 } 3937 3938 // Get returns all values pointed by specific field from source ActivityLog_Resource 3939 func (fp *ActivityLogResource_FieldTerminalPath) Get(source *ActivityLog_Resource) (values []interface{}) { 3940 if source != nil { 3941 switch fp.selector { 3942 case ActivityLogResource_FieldPathSelectorName: 3943 values = append(values, source.Name) 3944 case ActivityLogResource_FieldPathSelectorDifference: 3945 if source.Difference != nil { 3946 values = append(values, source.Difference) 3947 } 3948 default: 3949 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fp.selector)) 3950 } 3951 } 3952 return 3953 } 3954 3955 func (fp *ActivityLogResource_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3956 return fp.Get(source.(*ActivityLog_Resource)) 3957 } 3958 3959 // GetSingle returns value pointed by specific field of from source ActivityLog_Resource 3960 func (fp *ActivityLogResource_FieldTerminalPath) GetSingle(source *ActivityLog_Resource) (interface{}, bool) { 3961 switch fp.selector { 3962 case ActivityLogResource_FieldPathSelectorName: 3963 return source.GetName(), source != nil 3964 case ActivityLogResource_FieldPathSelectorDifference: 3965 res := source.GetDifference() 3966 return res, res != nil 3967 default: 3968 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fp.selector)) 3969 } 3970 } 3971 3972 func (fp *ActivityLogResource_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3973 return fp.GetSingle(source.(*ActivityLog_Resource)) 3974 } 3975 3976 // GetDefault returns a default value of the field type 3977 func (fp *ActivityLogResource_FieldTerminalPath) GetDefault() interface{} { 3978 switch fp.selector { 3979 case ActivityLogResource_FieldPathSelectorName: 3980 return "" 3981 case ActivityLogResource_FieldPathSelectorDifference: 3982 return (*ActivityLog_Resource_Difference)(nil) 3983 default: 3984 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fp.selector)) 3985 } 3986 } 3987 3988 func (fp *ActivityLogResource_FieldTerminalPath) ClearValue(item *ActivityLog_Resource) { 3989 if item != nil { 3990 switch fp.selector { 3991 case ActivityLogResource_FieldPathSelectorName: 3992 item.Name = "" 3993 case ActivityLogResource_FieldPathSelectorDifference: 3994 item.Difference = nil 3995 default: 3996 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fp.selector)) 3997 } 3998 } 3999 } 4000 4001 func (fp *ActivityLogResource_FieldTerminalPath) ClearValueRaw(item proto.Message) { 4002 fp.ClearValue(item.(*ActivityLog_Resource)) 4003 } 4004 4005 // IsLeaf - whether field path is holds simple value 4006 func (fp *ActivityLogResource_FieldTerminalPath) IsLeaf() bool { 4007 return fp.selector == ActivityLogResource_FieldPathSelectorName 4008 } 4009 4010 func (fp *ActivityLogResource_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4011 return []gotenobject.FieldPath{fp} 4012 } 4013 4014 func (fp *ActivityLogResource_FieldTerminalPath) WithIValue(value interface{}) ActivityLogResource_FieldPathValue { 4015 switch fp.selector { 4016 case ActivityLogResource_FieldPathSelectorName: 4017 return &ActivityLogResource_FieldTerminalPathValue{ActivityLogResource_FieldTerminalPath: *fp, value: value.(string)} 4018 case ActivityLogResource_FieldPathSelectorDifference: 4019 return &ActivityLogResource_FieldTerminalPathValue{ActivityLogResource_FieldTerminalPath: *fp, value: value.(*ActivityLog_Resource_Difference)} 4020 default: 4021 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fp.selector)) 4022 } 4023 } 4024 4025 func (fp *ActivityLogResource_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4026 return fp.WithIValue(value) 4027 } 4028 4029 func (fp *ActivityLogResource_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogResource_FieldPathArrayOfValues { 4030 fpaov := &ActivityLogResource_FieldTerminalPathArrayOfValues{ActivityLogResource_FieldTerminalPath: *fp} 4031 switch fp.selector { 4032 case ActivityLogResource_FieldPathSelectorName: 4033 return &ActivityLogResource_FieldTerminalPathArrayOfValues{ActivityLogResource_FieldTerminalPath: *fp, values: values.([]string)} 4034 case ActivityLogResource_FieldPathSelectorDifference: 4035 return &ActivityLogResource_FieldTerminalPathArrayOfValues{ActivityLogResource_FieldTerminalPath: *fp, values: values.([]*ActivityLog_Resource_Difference)} 4036 default: 4037 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fp.selector)) 4038 } 4039 return fpaov 4040 } 4041 4042 func (fp *ActivityLogResource_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4043 return fp.WithIArrayOfValues(values) 4044 } 4045 4046 func (fp *ActivityLogResource_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogResource_FieldPathArrayItemValue { 4047 switch fp.selector { 4048 default: 4049 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fp.selector)) 4050 } 4051 } 4052 4053 func (fp *ActivityLogResource_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4054 return fp.WithIArrayItemValue(value) 4055 } 4056 4057 type ActivityLogResource_FieldSubPath struct { 4058 selector ActivityLogResource_FieldPathSelector 4059 subPath gotenobject.FieldPath 4060 } 4061 4062 var _ ActivityLogResource_FieldPath = (*ActivityLogResource_FieldSubPath)(nil) 4063 4064 func (fps *ActivityLogResource_FieldSubPath) Selector() ActivityLogResource_FieldPathSelector { 4065 return fps.selector 4066 } 4067 func (fps *ActivityLogResource_FieldSubPath) AsDifferenceSubPath() (ActivityLogResourceDifference_FieldPath, bool) { 4068 res, ok := fps.subPath.(ActivityLogResourceDifference_FieldPath) 4069 return res, ok 4070 } 4071 4072 // String returns path representation in proto convention 4073 func (fps *ActivityLogResource_FieldSubPath) String() string { 4074 return fps.selector.String() + "." + fps.subPath.String() 4075 } 4076 4077 // JSONString returns path representation is JSON convention 4078 func (fps *ActivityLogResource_FieldSubPath) JSONString() string { 4079 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 4080 } 4081 4082 // Get returns all values pointed by selected field from source ActivityLog_Resource 4083 func (fps *ActivityLogResource_FieldSubPath) Get(source *ActivityLog_Resource) (values []interface{}) { 4084 switch fps.selector { 4085 case ActivityLogResource_FieldPathSelectorDifference: 4086 values = append(values, fps.subPath.GetRaw(source.GetDifference())...) 4087 default: 4088 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fps.selector)) 4089 } 4090 return 4091 } 4092 4093 func (fps *ActivityLogResource_FieldSubPath) GetRaw(source proto.Message) []interface{} { 4094 return fps.Get(source.(*ActivityLog_Resource)) 4095 } 4096 4097 // GetSingle returns value of selected field from source ActivityLog_Resource 4098 func (fps *ActivityLogResource_FieldSubPath) GetSingle(source *ActivityLog_Resource) (interface{}, bool) { 4099 switch fps.selector { 4100 case ActivityLogResource_FieldPathSelectorDifference: 4101 if source.GetDifference() == nil { 4102 return nil, false 4103 } 4104 return fps.subPath.GetSingleRaw(source.GetDifference()) 4105 default: 4106 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fps.selector)) 4107 } 4108 } 4109 4110 func (fps *ActivityLogResource_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4111 return fps.GetSingle(source.(*ActivityLog_Resource)) 4112 } 4113 4114 // GetDefault returns a default value of the field type 4115 func (fps *ActivityLogResource_FieldSubPath) GetDefault() interface{} { 4116 return fps.subPath.GetDefault() 4117 } 4118 4119 func (fps *ActivityLogResource_FieldSubPath) ClearValue(item *ActivityLog_Resource) { 4120 if item != nil { 4121 switch fps.selector { 4122 case ActivityLogResource_FieldPathSelectorDifference: 4123 fps.subPath.ClearValueRaw(item.Difference) 4124 default: 4125 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fps.selector)) 4126 } 4127 } 4128 } 4129 4130 func (fps *ActivityLogResource_FieldSubPath) ClearValueRaw(item proto.Message) { 4131 fps.ClearValue(item.(*ActivityLog_Resource)) 4132 } 4133 4134 // IsLeaf - whether field path is holds simple value 4135 func (fps *ActivityLogResource_FieldSubPath) IsLeaf() bool { 4136 return fps.subPath.IsLeaf() 4137 } 4138 4139 func (fps *ActivityLogResource_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4140 iPaths := []gotenobject.FieldPath{&ActivityLogResource_FieldTerminalPath{selector: fps.selector}} 4141 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 4142 return iPaths 4143 } 4144 4145 func (fps *ActivityLogResource_FieldSubPath) WithIValue(value interface{}) ActivityLogResource_FieldPathValue { 4146 return &ActivityLogResource_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 4147 } 4148 4149 func (fps *ActivityLogResource_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4150 return fps.WithIValue(value) 4151 } 4152 4153 func (fps *ActivityLogResource_FieldSubPath) WithIArrayOfValues(values interface{}) ActivityLogResource_FieldPathArrayOfValues { 4154 return &ActivityLogResource_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 4155 } 4156 4157 func (fps *ActivityLogResource_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4158 return fps.WithIArrayOfValues(values) 4159 } 4160 4161 func (fps *ActivityLogResource_FieldSubPath) WithIArrayItemValue(value interface{}) ActivityLogResource_FieldPathArrayItemValue { 4162 return &ActivityLogResource_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 4163 } 4164 4165 func (fps *ActivityLogResource_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4166 return fps.WithIArrayItemValue(value) 4167 } 4168 4169 // ActivityLogResource_FieldPathValue allows storing values for Resource fields according to their type 4170 type ActivityLogResource_FieldPathValue interface { 4171 ActivityLogResource_FieldPath 4172 gotenobject.FieldPathValue 4173 SetTo(target **ActivityLog_Resource) 4174 CompareWith(*ActivityLog_Resource) (cmp int, comparable bool) 4175 } 4176 4177 func ParseActivityLogResource_FieldPathValue(pathStr, valueStr string) (ActivityLogResource_FieldPathValue, error) { 4178 fp, err := ParseActivityLogResource_FieldPath(pathStr) 4179 if err != nil { 4180 return nil, err 4181 } 4182 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4183 if err != nil { 4184 return nil, status.Errorf(codes.InvalidArgument, "error parsing Resource field path value from %s: %v", valueStr, err) 4185 } 4186 return fpv.(ActivityLogResource_FieldPathValue), nil 4187 } 4188 4189 func MustParseActivityLogResource_FieldPathValue(pathStr, valueStr string) ActivityLogResource_FieldPathValue { 4190 fpv, err := ParseActivityLogResource_FieldPathValue(pathStr, valueStr) 4191 if err != nil { 4192 panic(err) 4193 } 4194 return fpv 4195 } 4196 4197 type ActivityLogResource_FieldTerminalPathValue struct { 4198 ActivityLogResource_FieldTerminalPath 4199 value interface{} 4200 } 4201 4202 var _ ActivityLogResource_FieldPathValue = (*ActivityLogResource_FieldTerminalPathValue)(nil) 4203 4204 // GetRawValue returns raw value stored under selected path for 'Resource' as interface{} 4205 func (fpv *ActivityLogResource_FieldTerminalPathValue) GetRawValue() interface{} { 4206 return fpv.value 4207 } 4208 func (fpv *ActivityLogResource_FieldTerminalPathValue) AsNameValue() (string, bool) { 4209 res, ok := fpv.value.(string) 4210 return res, ok 4211 } 4212 func (fpv *ActivityLogResource_FieldTerminalPathValue) AsDifferenceValue() (*ActivityLog_Resource_Difference, bool) { 4213 res, ok := fpv.value.(*ActivityLog_Resource_Difference) 4214 return res, ok 4215 } 4216 4217 // SetTo stores value for selected field for object Resource 4218 func (fpv *ActivityLogResource_FieldTerminalPathValue) SetTo(target **ActivityLog_Resource) { 4219 if *target == nil { 4220 *target = new(ActivityLog_Resource) 4221 } 4222 switch fpv.selector { 4223 case ActivityLogResource_FieldPathSelectorName: 4224 (*target).Name = fpv.value.(string) 4225 case ActivityLogResource_FieldPathSelectorDifference: 4226 (*target).Difference = fpv.value.(*ActivityLog_Resource_Difference) 4227 default: 4228 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fpv.selector)) 4229 } 4230 } 4231 4232 func (fpv *ActivityLogResource_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4233 typedObject := target.(*ActivityLog_Resource) 4234 fpv.SetTo(&typedObject) 4235 } 4236 4237 // CompareWith compares value in the 'ActivityLogResource_FieldTerminalPathValue' with the value under path in 'ActivityLog_Resource'. 4238 func (fpv *ActivityLogResource_FieldTerminalPathValue) CompareWith(source *ActivityLog_Resource) (int, bool) { 4239 switch fpv.selector { 4240 case ActivityLogResource_FieldPathSelectorName: 4241 leftValue := fpv.value.(string) 4242 rightValue := source.GetName() 4243 if (leftValue) == (rightValue) { 4244 return 0, true 4245 } else if (leftValue) < (rightValue) { 4246 return -1, true 4247 } else { 4248 return 1, true 4249 } 4250 case ActivityLogResource_FieldPathSelectorDifference: 4251 return 0, false 4252 default: 4253 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fpv.selector)) 4254 } 4255 } 4256 4257 func (fpv *ActivityLogResource_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4258 return fpv.CompareWith(source.(*ActivityLog_Resource)) 4259 } 4260 4261 type ActivityLogResource_FieldSubPathValue struct { 4262 ActivityLogResource_FieldPath 4263 subPathValue gotenobject.FieldPathValue 4264 } 4265 4266 var _ ActivityLogResource_FieldPathValue = (*ActivityLogResource_FieldSubPathValue)(nil) 4267 4268 func (fpvs *ActivityLogResource_FieldSubPathValue) AsDifferencePathValue() (ActivityLogResourceDifference_FieldPathValue, bool) { 4269 res, ok := fpvs.subPathValue.(ActivityLogResourceDifference_FieldPathValue) 4270 return res, ok 4271 } 4272 4273 func (fpvs *ActivityLogResource_FieldSubPathValue) SetTo(target **ActivityLog_Resource) { 4274 if *target == nil { 4275 *target = new(ActivityLog_Resource) 4276 } 4277 switch fpvs.Selector() { 4278 case ActivityLogResource_FieldPathSelectorDifference: 4279 fpvs.subPathValue.(ActivityLogResourceDifference_FieldPathValue).SetTo(&(*target).Difference) 4280 default: 4281 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fpvs.Selector())) 4282 } 4283 } 4284 4285 func (fpvs *ActivityLogResource_FieldSubPathValue) SetToRaw(target proto.Message) { 4286 typedObject := target.(*ActivityLog_Resource) 4287 fpvs.SetTo(&typedObject) 4288 } 4289 4290 func (fpvs *ActivityLogResource_FieldSubPathValue) GetRawValue() interface{} { 4291 return fpvs.subPathValue.GetRawValue() 4292 } 4293 4294 func (fpvs *ActivityLogResource_FieldSubPathValue) CompareWith(source *ActivityLog_Resource) (int, bool) { 4295 switch fpvs.Selector() { 4296 case ActivityLogResource_FieldPathSelectorDifference: 4297 return fpvs.subPathValue.(ActivityLogResourceDifference_FieldPathValue).CompareWith(source.GetDifference()) 4298 default: 4299 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fpvs.Selector())) 4300 } 4301 } 4302 4303 func (fpvs *ActivityLogResource_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4304 return fpvs.CompareWith(source.(*ActivityLog_Resource)) 4305 } 4306 4307 // ActivityLogResource_FieldPathArrayItemValue allows storing single item in Path-specific values for Resource according to their type 4308 // Present only for array (repeated) types. 4309 type ActivityLogResource_FieldPathArrayItemValue interface { 4310 gotenobject.FieldPathArrayItemValue 4311 ActivityLogResource_FieldPath 4312 ContainsValue(*ActivityLog_Resource) bool 4313 } 4314 4315 // ParseActivityLogResource_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4316 func ParseActivityLogResource_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogResource_FieldPathArrayItemValue, error) { 4317 fp, err := ParseActivityLogResource_FieldPath(pathStr) 4318 if err != nil { 4319 return nil, err 4320 } 4321 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4322 if err != nil { 4323 return nil, status.Errorf(codes.InvalidArgument, "error parsing Resource field path array item value from %s: %v", valueStr, err) 4324 } 4325 return fpaiv.(ActivityLogResource_FieldPathArrayItemValue), nil 4326 } 4327 4328 func MustParseActivityLogResource_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogResource_FieldPathArrayItemValue { 4329 fpaiv, err := ParseActivityLogResource_FieldPathArrayItemValue(pathStr, valueStr) 4330 if err != nil { 4331 panic(err) 4332 } 4333 return fpaiv 4334 } 4335 4336 type ActivityLogResource_FieldTerminalPathArrayItemValue struct { 4337 ActivityLogResource_FieldTerminalPath 4338 value interface{} 4339 } 4340 4341 var _ ActivityLogResource_FieldPathArrayItemValue = (*ActivityLogResource_FieldTerminalPathArrayItemValue)(nil) 4342 4343 // GetRawValue returns stored element value for array in object ActivityLog_Resource as interface{} 4344 func (fpaiv *ActivityLogResource_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4345 return fpaiv.value 4346 } 4347 4348 func (fpaiv *ActivityLogResource_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_Resource) (interface{}, bool) { 4349 return nil, false 4350 } 4351 4352 func (fpaiv *ActivityLogResource_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4353 return fpaiv.GetSingle(source.(*ActivityLog_Resource)) 4354 } 4355 4356 // Contains returns a boolean indicating if value that is being held is present in given 'Resource' 4357 func (fpaiv *ActivityLogResource_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_Resource) bool { 4358 slice := fpaiv.ActivityLogResource_FieldTerminalPath.Get(source) 4359 for _, v := range slice { 4360 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4361 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4362 return true 4363 } 4364 } else if reflect.DeepEqual(v, fpaiv.value) { 4365 return true 4366 } 4367 } 4368 return false 4369 } 4370 4371 type ActivityLogResource_FieldSubPathArrayItemValue struct { 4372 ActivityLogResource_FieldPath 4373 subPathItemValue gotenobject.FieldPathArrayItemValue 4374 } 4375 4376 // GetRawValue returns stored array item value 4377 func (fpaivs *ActivityLogResource_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 4378 return fpaivs.subPathItemValue.GetRawItemValue() 4379 } 4380 func (fpaivs *ActivityLogResource_FieldSubPathArrayItemValue) AsDifferencePathItemValue() (ActivityLogResourceDifference_FieldPathArrayItemValue, bool) { 4381 res, ok := fpaivs.subPathItemValue.(ActivityLogResourceDifference_FieldPathArrayItemValue) 4382 return res, ok 4383 } 4384 4385 // Contains returns a boolean indicating if value that is being held is present in given 'Resource' 4386 func (fpaivs *ActivityLogResource_FieldSubPathArrayItemValue) ContainsValue(source *ActivityLog_Resource) bool { 4387 switch fpaivs.Selector() { 4388 case ActivityLogResource_FieldPathSelectorDifference: 4389 return fpaivs.subPathItemValue.(ActivityLogResourceDifference_FieldPathArrayItemValue).ContainsValue(source.GetDifference()) 4390 default: 4391 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource: %d", fpaivs.Selector())) 4392 } 4393 } 4394 4395 // ActivityLogResource_FieldPathArrayOfValues allows storing slice of values for Resource fields according to their type 4396 type ActivityLogResource_FieldPathArrayOfValues interface { 4397 gotenobject.FieldPathArrayOfValues 4398 ActivityLogResource_FieldPath 4399 } 4400 4401 func ParseActivityLogResource_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogResource_FieldPathArrayOfValues, error) { 4402 fp, err := ParseActivityLogResource_FieldPath(pathStr) 4403 if err != nil { 4404 return nil, err 4405 } 4406 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4407 if err != nil { 4408 return nil, status.Errorf(codes.InvalidArgument, "error parsing Resource field path array of values from %s: %v", valuesStr, err) 4409 } 4410 return fpaov.(ActivityLogResource_FieldPathArrayOfValues), nil 4411 } 4412 4413 func MustParseActivityLogResource_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogResource_FieldPathArrayOfValues { 4414 fpaov, err := ParseActivityLogResource_FieldPathArrayOfValues(pathStr, valuesStr) 4415 if err != nil { 4416 panic(err) 4417 } 4418 return fpaov 4419 } 4420 4421 type ActivityLogResource_FieldTerminalPathArrayOfValues struct { 4422 ActivityLogResource_FieldTerminalPath 4423 values interface{} 4424 } 4425 4426 var _ ActivityLogResource_FieldPathArrayOfValues = (*ActivityLogResource_FieldTerminalPathArrayOfValues)(nil) 4427 4428 func (fpaov *ActivityLogResource_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4429 switch fpaov.selector { 4430 case ActivityLogResource_FieldPathSelectorName: 4431 for _, v := range fpaov.values.([]string) { 4432 values = append(values, v) 4433 } 4434 case ActivityLogResource_FieldPathSelectorDifference: 4435 for _, v := range fpaov.values.([]*ActivityLog_Resource_Difference) { 4436 values = append(values, v) 4437 } 4438 } 4439 return 4440 } 4441 func (fpaov *ActivityLogResource_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]string, bool) { 4442 res, ok := fpaov.values.([]string) 4443 return res, ok 4444 } 4445 func (fpaov *ActivityLogResource_FieldTerminalPathArrayOfValues) AsDifferenceArrayOfValues() ([]*ActivityLog_Resource_Difference, bool) { 4446 res, ok := fpaov.values.([]*ActivityLog_Resource_Difference) 4447 return res, ok 4448 } 4449 4450 type ActivityLogResource_FieldSubPathArrayOfValues struct { 4451 ActivityLogResource_FieldPath 4452 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 4453 } 4454 4455 var _ ActivityLogResource_FieldPathArrayOfValues = (*ActivityLogResource_FieldSubPathArrayOfValues)(nil) 4456 4457 func (fpsaov *ActivityLogResource_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 4458 return fpsaov.subPathArrayOfValues.GetRawValues() 4459 } 4460 func (fpsaov *ActivityLogResource_FieldSubPathArrayOfValues) AsDifferencePathArrayOfValues() (ActivityLogResourceDifference_FieldPathArrayOfValues, bool) { 4461 res, ok := fpsaov.subPathArrayOfValues.(ActivityLogResourceDifference_FieldPathArrayOfValues) 4462 return res, ok 4463 } 4464 4465 // FieldPath provides implementation to handle 4466 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 4467 type ActivityLogEventClientMsgEvent_FieldPath interface { 4468 gotenobject.FieldPath 4469 Selector() ActivityLogEventClientMsgEvent_FieldPathSelector 4470 Get(source *ActivityLog_Event_ClientMsgEvent) []interface{} 4471 GetSingle(source *ActivityLog_Event_ClientMsgEvent) (interface{}, bool) 4472 ClearValue(item *ActivityLog_Event_ClientMsgEvent) 4473 4474 // Those methods build corresponding ActivityLogEventClientMsgEvent_FieldPathValue 4475 // (or array of values) and holds passed value. Panics if injected type is incorrect. 4476 WithIValue(value interface{}) ActivityLogEventClientMsgEvent_FieldPathValue 4477 WithIArrayOfValues(values interface{}) ActivityLogEventClientMsgEvent_FieldPathArrayOfValues 4478 WithIArrayItemValue(value interface{}) ActivityLogEventClientMsgEvent_FieldPathArrayItemValue 4479 } 4480 4481 type ActivityLogEventClientMsgEvent_FieldPathSelector int32 4482 4483 const ( 4484 ActivityLogEventClientMsgEvent_FieldPathSelectorData ActivityLogEventClientMsgEvent_FieldPathSelector = 0 4485 ActivityLogEventClientMsgEvent_FieldPathSelectorTime ActivityLogEventClientMsgEvent_FieldPathSelector = 1 4486 ) 4487 4488 func (s ActivityLogEventClientMsgEvent_FieldPathSelector) String() string { 4489 switch s { 4490 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4491 return "data" 4492 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4493 return "time" 4494 default: 4495 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", s)) 4496 } 4497 } 4498 4499 func BuildActivityLogEventClientMsgEvent_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogEventClientMsgEvent_FieldPath, error) { 4500 if len(fp) == 0 { 4501 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_Event_ClientMsgEvent") 4502 } 4503 if len(fp) == 1 { 4504 switch fp[0] { 4505 case "data": 4506 return &ActivityLogEventClientMsgEvent_FieldTerminalPath{selector: ActivityLogEventClientMsgEvent_FieldPathSelectorData}, nil 4507 case "time": 4508 return &ActivityLogEventClientMsgEvent_FieldTerminalPath{selector: ActivityLogEventClientMsgEvent_FieldPathSelectorTime}, nil 4509 } 4510 } 4511 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_Event_ClientMsgEvent", fp) 4512 } 4513 4514 func ParseActivityLogEventClientMsgEvent_FieldPath(rawField string) (ActivityLogEventClientMsgEvent_FieldPath, error) { 4515 fp, err := gotenobject.ParseRawFieldPath(rawField) 4516 if err != nil { 4517 return nil, err 4518 } 4519 return BuildActivityLogEventClientMsgEvent_FieldPath(fp) 4520 } 4521 4522 func MustParseActivityLogEventClientMsgEvent_FieldPath(rawField string) ActivityLogEventClientMsgEvent_FieldPath { 4523 fp, err := ParseActivityLogEventClientMsgEvent_FieldPath(rawField) 4524 if err != nil { 4525 panic(err) 4526 } 4527 return fp 4528 } 4529 4530 type ActivityLogEventClientMsgEvent_FieldTerminalPath struct { 4531 selector ActivityLogEventClientMsgEvent_FieldPathSelector 4532 } 4533 4534 var _ ActivityLogEventClientMsgEvent_FieldPath = (*ActivityLogEventClientMsgEvent_FieldTerminalPath)(nil) 4535 4536 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) Selector() ActivityLogEventClientMsgEvent_FieldPathSelector { 4537 return fp.selector 4538 } 4539 4540 // String returns path representation in proto convention 4541 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) String() string { 4542 return fp.selector.String() 4543 } 4544 4545 // JSONString returns path representation is JSON convention 4546 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) JSONString() string { 4547 return strcase.ToLowerCamel(fp.String()) 4548 } 4549 4550 // Get returns all values pointed by specific field from source ActivityLog_Event_ClientMsgEvent 4551 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) Get(source *ActivityLog_Event_ClientMsgEvent) (values []interface{}) { 4552 if source != nil { 4553 switch fp.selector { 4554 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4555 if source.Data != nil { 4556 values = append(values, source.Data) 4557 } 4558 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4559 if source.Time != nil { 4560 values = append(values, source.Time) 4561 } 4562 default: 4563 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", fp.selector)) 4564 } 4565 } 4566 return 4567 } 4568 4569 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 4570 return fp.Get(source.(*ActivityLog_Event_ClientMsgEvent)) 4571 } 4572 4573 // GetSingle returns value pointed by specific field of from source ActivityLog_Event_ClientMsgEvent 4574 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) GetSingle(source *ActivityLog_Event_ClientMsgEvent) (interface{}, bool) { 4575 switch fp.selector { 4576 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4577 res := source.GetData() 4578 return res, res != nil 4579 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4580 res := source.GetTime() 4581 return res, res != nil 4582 default: 4583 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", fp.selector)) 4584 } 4585 } 4586 4587 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4588 return fp.GetSingle(source.(*ActivityLog_Event_ClientMsgEvent)) 4589 } 4590 4591 // GetDefault returns a default value of the field type 4592 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) GetDefault() interface{} { 4593 switch fp.selector { 4594 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4595 return (*anypb.Any)(nil) 4596 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4597 return (*timestamppb.Timestamp)(nil) 4598 default: 4599 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", fp.selector)) 4600 } 4601 } 4602 4603 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) ClearValue(item *ActivityLog_Event_ClientMsgEvent) { 4604 if item != nil { 4605 switch fp.selector { 4606 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4607 item.Data = nil 4608 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4609 item.Time = nil 4610 default: 4611 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", fp.selector)) 4612 } 4613 } 4614 } 4615 4616 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) ClearValueRaw(item proto.Message) { 4617 fp.ClearValue(item.(*ActivityLog_Event_ClientMsgEvent)) 4618 } 4619 4620 // IsLeaf - whether field path is holds simple value 4621 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) IsLeaf() bool { 4622 return fp.selector == ActivityLogEventClientMsgEvent_FieldPathSelectorData || 4623 fp.selector == ActivityLogEventClientMsgEvent_FieldPathSelectorTime 4624 } 4625 4626 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4627 return []gotenobject.FieldPath{fp} 4628 } 4629 4630 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) WithIValue(value interface{}) ActivityLogEventClientMsgEvent_FieldPathValue { 4631 switch fp.selector { 4632 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4633 return &ActivityLogEventClientMsgEvent_FieldTerminalPathValue{ActivityLogEventClientMsgEvent_FieldTerminalPath: *fp, value: value.(*anypb.Any)} 4634 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4635 return &ActivityLogEventClientMsgEvent_FieldTerminalPathValue{ActivityLogEventClientMsgEvent_FieldTerminalPath: *fp, value: value.(*timestamppb.Timestamp)} 4636 default: 4637 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", fp.selector)) 4638 } 4639 } 4640 4641 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4642 return fp.WithIValue(value) 4643 } 4644 4645 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogEventClientMsgEvent_FieldPathArrayOfValues { 4646 fpaov := &ActivityLogEventClientMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventClientMsgEvent_FieldTerminalPath: *fp} 4647 switch fp.selector { 4648 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4649 return &ActivityLogEventClientMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventClientMsgEvent_FieldTerminalPath: *fp, values: values.([]*anypb.Any)} 4650 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4651 return &ActivityLogEventClientMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventClientMsgEvent_FieldTerminalPath: *fp, values: values.([]*timestamppb.Timestamp)} 4652 default: 4653 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", fp.selector)) 4654 } 4655 return fpaov 4656 } 4657 4658 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4659 return fp.WithIArrayOfValues(values) 4660 } 4661 4662 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogEventClientMsgEvent_FieldPathArrayItemValue { 4663 switch fp.selector { 4664 default: 4665 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", fp.selector)) 4666 } 4667 } 4668 4669 func (fp *ActivityLogEventClientMsgEvent_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4670 return fp.WithIArrayItemValue(value) 4671 } 4672 4673 // ActivityLogEventClientMsgEvent_FieldPathValue allows storing values for ClientMsgEvent fields according to their type 4674 type ActivityLogEventClientMsgEvent_FieldPathValue interface { 4675 ActivityLogEventClientMsgEvent_FieldPath 4676 gotenobject.FieldPathValue 4677 SetTo(target **ActivityLog_Event_ClientMsgEvent) 4678 CompareWith(*ActivityLog_Event_ClientMsgEvent) (cmp int, comparable bool) 4679 } 4680 4681 func ParseActivityLogEventClientMsgEvent_FieldPathValue(pathStr, valueStr string) (ActivityLogEventClientMsgEvent_FieldPathValue, error) { 4682 fp, err := ParseActivityLogEventClientMsgEvent_FieldPath(pathStr) 4683 if err != nil { 4684 return nil, err 4685 } 4686 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4687 if err != nil { 4688 return nil, status.Errorf(codes.InvalidArgument, "error parsing ClientMsgEvent field path value from %s: %v", valueStr, err) 4689 } 4690 return fpv.(ActivityLogEventClientMsgEvent_FieldPathValue), nil 4691 } 4692 4693 func MustParseActivityLogEventClientMsgEvent_FieldPathValue(pathStr, valueStr string) ActivityLogEventClientMsgEvent_FieldPathValue { 4694 fpv, err := ParseActivityLogEventClientMsgEvent_FieldPathValue(pathStr, valueStr) 4695 if err != nil { 4696 panic(err) 4697 } 4698 return fpv 4699 } 4700 4701 type ActivityLogEventClientMsgEvent_FieldTerminalPathValue struct { 4702 ActivityLogEventClientMsgEvent_FieldTerminalPath 4703 value interface{} 4704 } 4705 4706 var _ ActivityLogEventClientMsgEvent_FieldPathValue = (*ActivityLogEventClientMsgEvent_FieldTerminalPathValue)(nil) 4707 4708 // GetRawValue returns raw value stored under selected path for 'ClientMsgEvent' as interface{} 4709 func (fpv *ActivityLogEventClientMsgEvent_FieldTerminalPathValue) GetRawValue() interface{} { 4710 return fpv.value 4711 } 4712 func (fpv *ActivityLogEventClientMsgEvent_FieldTerminalPathValue) AsDataValue() (*anypb.Any, bool) { 4713 res, ok := fpv.value.(*anypb.Any) 4714 return res, ok 4715 } 4716 func (fpv *ActivityLogEventClientMsgEvent_FieldTerminalPathValue) AsTimeValue() (*timestamppb.Timestamp, bool) { 4717 res, ok := fpv.value.(*timestamppb.Timestamp) 4718 return res, ok 4719 } 4720 4721 // SetTo stores value for selected field for object ClientMsgEvent 4722 func (fpv *ActivityLogEventClientMsgEvent_FieldTerminalPathValue) SetTo(target **ActivityLog_Event_ClientMsgEvent) { 4723 if *target == nil { 4724 *target = new(ActivityLog_Event_ClientMsgEvent) 4725 } 4726 switch fpv.selector { 4727 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4728 (*target).Data = fpv.value.(*anypb.Any) 4729 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4730 (*target).Time = fpv.value.(*timestamppb.Timestamp) 4731 default: 4732 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", fpv.selector)) 4733 } 4734 } 4735 4736 func (fpv *ActivityLogEventClientMsgEvent_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4737 typedObject := target.(*ActivityLog_Event_ClientMsgEvent) 4738 fpv.SetTo(&typedObject) 4739 } 4740 4741 // CompareWith compares value in the 'ActivityLogEventClientMsgEvent_FieldTerminalPathValue' with the value under path in 'ActivityLog_Event_ClientMsgEvent'. 4742 func (fpv *ActivityLogEventClientMsgEvent_FieldTerminalPathValue) CompareWith(source *ActivityLog_Event_ClientMsgEvent) (int, bool) { 4743 switch fpv.selector { 4744 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4745 return 0, false 4746 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4747 leftValue := fpv.value.(*timestamppb.Timestamp) 4748 rightValue := source.GetTime() 4749 if leftValue == nil { 4750 if rightValue != nil { 4751 return -1, true 4752 } 4753 return 0, true 4754 } 4755 if rightValue == nil { 4756 return 1, true 4757 } 4758 if leftValue.AsTime().Equal(rightValue.AsTime()) { 4759 return 0, true 4760 } else if leftValue.AsTime().Before(rightValue.AsTime()) { 4761 return -1, true 4762 } else { 4763 return 1, true 4764 } 4765 default: 4766 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ClientMsgEvent: %d", fpv.selector)) 4767 } 4768 } 4769 4770 func (fpv *ActivityLogEventClientMsgEvent_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4771 return fpv.CompareWith(source.(*ActivityLog_Event_ClientMsgEvent)) 4772 } 4773 4774 // ActivityLogEventClientMsgEvent_FieldPathArrayItemValue allows storing single item in Path-specific values for ClientMsgEvent according to their type 4775 // Present only for array (repeated) types. 4776 type ActivityLogEventClientMsgEvent_FieldPathArrayItemValue interface { 4777 gotenobject.FieldPathArrayItemValue 4778 ActivityLogEventClientMsgEvent_FieldPath 4779 ContainsValue(*ActivityLog_Event_ClientMsgEvent) bool 4780 } 4781 4782 // ParseActivityLogEventClientMsgEvent_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4783 func ParseActivityLogEventClientMsgEvent_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogEventClientMsgEvent_FieldPathArrayItemValue, error) { 4784 fp, err := ParseActivityLogEventClientMsgEvent_FieldPath(pathStr) 4785 if err != nil { 4786 return nil, err 4787 } 4788 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4789 if err != nil { 4790 return nil, status.Errorf(codes.InvalidArgument, "error parsing ClientMsgEvent field path array item value from %s: %v", valueStr, err) 4791 } 4792 return fpaiv.(ActivityLogEventClientMsgEvent_FieldPathArrayItemValue), nil 4793 } 4794 4795 func MustParseActivityLogEventClientMsgEvent_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogEventClientMsgEvent_FieldPathArrayItemValue { 4796 fpaiv, err := ParseActivityLogEventClientMsgEvent_FieldPathArrayItemValue(pathStr, valueStr) 4797 if err != nil { 4798 panic(err) 4799 } 4800 return fpaiv 4801 } 4802 4803 type ActivityLogEventClientMsgEvent_FieldTerminalPathArrayItemValue struct { 4804 ActivityLogEventClientMsgEvent_FieldTerminalPath 4805 value interface{} 4806 } 4807 4808 var _ ActivityLogEventClientMsgEvent_FieldPathArrayItemValue = (*ActivityLogEventClientMsgEvent_FieldTerminalPathArrayItemValue)(nil) 4809 4810 // GetRawValue returns stored element value for array in object ActivityLog_Event_ClientMsgEvent as interface{} 4811 func (fpaiv *ActivityLogEventClientMsgEvent_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4812 return fpaiv.value 4813 } 4814 4815 func (fpaiv *ActivityLogEventClientMsgEvent_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_Event_ClientMsgEvent) (interface{}, bool) { 4816 return nil, false 4817 } 4818 4819 func (fpaiv *ActivityLogEventClientMsgEvent_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4820 return fpaiv.GetSingle(source.(*ActivityLog_Event_ClientMsgEvent)) 4821 } 4822 4823 // Contains returns a boolean indicating if value that is being held is present in given 'ClientMsgEvent' 4824 func (fpaiv *ActivityLogEventClientMsgEvent_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_Event_ClientMsgEvent) bool { 4825 slice := fpaiv.ActivityLogEventClientMsgEvent_FieldTerminalPath.Get(source) 4826 for _, v := range slice { 4827 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4828 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4829 return true 4830 } 4831 } else if reflect.DeepEqual(v, fpaiv.value) { 4832 return true 4833 } 4834 } 4835 return false 4836 } 4837 4838 // ActivityLogEventClientMsgEvent_FieldPathArrayOfValues allows storing slice of values for ClientMsgEvent fields according to their type 4839 type ActivityLogEventClientMsgEvent_FieldPathArrayOfValues interface { 4840 gotenobject.FieldPathArrayOfValues 4841 ActivityLogEventClientMsgEvent_FieldPath 4842 } 4843 4844 func ParseActivityLogEventClientMsgEvent_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogEventClientMsgEvent_FieldPathArrayOfValues, error) { 4845 fp, err := ParseActivityLogEventClientMsgEvent_FieldPath(pathStr) 4846 if err != nil { 4847 return nil, err 4848 } 4849 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4850 if err != nil { 4851 return nil, status.Errorf(codes.InvalidArgument, "error parsing ClientMsgEvent field path array of values from %s: %v", valuesStr, err) 4852 } 4853 return fpaov.(ActivityLogEventClientMsgEvent_FieldPathArrayOfValues), nil 4854 } 4855 4856 func MustParseActivityLogEventClientMsgEvent_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogEventClientMsgEvent_FieldPathArrayOfValues { 4857 fpaov, err := ParseActivityLogEventClientMsgEvent_FieldPathArrayOfValues(pathStr, valuesStr) 4858 if err != nil { 4859 panic(err) 4860 } 4861 return fpaov 4862 } 4863 4864 type ActivityLogEventClientMsgEvent_FieldTerminalPathArrayOfValues struct { 4865 ActivityLogEventClientMsgEvent_FieldTerminalPath 4866 values interface{} 4867 } 4868 4869 var _ ActivityLogEventClientMsgEvent_FieldPathArrayOfValues = (*ActivityLogEventClientMsgEvent_FieldTerminalPathArrayOfValues)(nil) 4870 4871 func (fpaov *ActivityLogEventClientMsgEvent_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4872 switch fpaov.selector { 4873 case ActivityLogEventClientMsgEvent_FieldPathSelectorData: 4874 for _, v := range fpaov.values.([]*anypb.Any) { 4875 values = append(values, v) 4876 } 4877 case ActivityLogEventClientMsgEvent_FieldPathSelectorTime: 4878 for _, v := range fpaov.values.([]*timestamppb.Timestamp) { 4879 values = append(values, v) 4880 } 4881 } 4882 return 4883 } 4884 func (fpaov *ActivityLogEventClientMsgEvent_FieldTerminalPathArrayOfValues) AsDataArrayOfValues() ([]*anypb.Any, bool) { 4885 res, ok := fpaov.values.([]*anypb.Any) 4886 return res, ok 4887 } 4888 func (fpaov *ActivityLogEventClientMsgEvent_FieldTerminalPathArrayOfValues) AsTimeArrayOfValues() ([]*timestamppb.Timestamp, bool) { 4889 res, ok := fpaov.values.([]*timestamppb.Timestamp) 4890 return res, ok 4891 } 4892 4893 // FieldPath provides implementation to handle 4894 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 4895 type ActivityLogEventRegionalServerMsgEvent_FieldPath interface { 4896 gotenobject.FieldPath 4897 Selector() ActivityLogEventRegionalServerMsgEvent_FieldPathSelector 4898 Get(source *ActivityLog_Event_RegionalServerMsgEvent) []interface{} 4899 GetSingle(source *ActivityLog_Event_RegionalServerMsgEvent) (interface{}, bool) 4900 ClearValue(item *ActivityLog_Event_RegionalServerMsgEvent) 4901 4902 // Those methods build corresponding ActivityLogEventRegionalServerMsgEvent_FieldPathValue 4903 // (or array of values) and holds passed value. Panics if injected type is incorrect. 4904 WithIValue(value interface{}) ActivityLogEventRegionalServerMsgEvent_FieldPathValue 4905 WithIArrayOfValues(values interface{}) ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues 4906 WithIArrayItemValue(value interface{}) ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue 4907 } 4908 4909 type ActivityLogEventRegionalServerMsgEvent_FieldPathSelector int32 4910 4911 const ( 4912 ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData ActivityLogEventRegionalServerMsgEvent_FieldPathSelector = 0 4913 ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime ActivityLogEventRegionalServerMsgEvent_FieldPathSelector = 1 4914 ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId ActivityLogEventRegionalServerMsgEvent_FieldPathSelector = 2 4915 ) 4916 4917 func (s ActivityLogEventRegionalServerMsgEvent_FieldPathSelector) String() string { 4918 switch s { 4919 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 4920 return "data" 4921 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 4922 return "time" 4923 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 4924 return "region_id" 4925 default: 4926 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", s)) 4927 } 4928 } 4929 4930 func BuildActivityLogEventRegionalServerMsgEvent_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogEventRegionalServerMsgEvent_FieldPath, error) { 4931 if len(fp) == 0 { 4932 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_Event_RegionalServerMsgEvent") 4933 } 4934 if len(fp) == 1 { 4935 switch fp[0] { 4936 case "data": 4937 return &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData}, nil 4938 case "time": 4939 return &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime}, nil 4940 case "region_id", "regionId", "region-id": 4941 return &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId}, nil 4942 } 4943 } 4944 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_Event_RegionalServerMsgEvent", fp) 4945 } 4946 4947 func ParseActivityLogEventRegionalServerMsgEvent_FieldPath(rawField string) (ActivityLogEventRegionalServerMsgEvent_FieldPath, error) { 4948 fp, err := gotenobject.ParseRawFieldPath(rawField) 4949 if err != nil { 4950 return nil, err 4951 } 4952 return BuildActivityLogEventRegionalServerMsgEvent_FieldPath(fp) 4953 } 4954 4955 func MustParseActivityLogEventRegionalServerMsgEvent_FieldPath(rawField string) ActivityLogEventRegionalServerMsgEvent_FieldPath { 4956 fp, err := ParseActivityLogEventRegionalServerMsgEvent_FieldPath(rawField) 4957 if err != nil { 4958 panic(err) 4959 } 4960 return fp 4961 } 4962 4963 type ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath struct { 4964 selector ActivityLogEventRegionalServerMsgEvent_FieldPathSelector 4965 } 4966 4967 var _ ActivityLogEventRegionalServerMsgEvent_FieldPath = (*ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath)(nil) 4968 4969 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) Selector() ActivityLogEventRegionalServerMsgEvent_FieldPathSelector { 4970 return fp.selector 4971 } 4972 4973 // String returns path representation in proto convention 4974 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) String() string { 4975 return fp.selector.String() 4976 } 4977 4978 // JSONString returns path representation is JSON convention 4979 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) JSONString() string { 4980 return strcase.ToLowerCamel(fp.String()) 4981 } 4982 4983 // Get returns all values pointed by specific field from source ActivityLog_Event_RegionalServerMsgEvent 4984 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) Get(source *ActivityLog_Event_RegionalServerMsgEvent) (values []interface{}) { 4985 if source != nil { 4986 switch fp.selector { 4987 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 4988 if source.Data != nil { 4989 values = append(values, source.Data) 4990 } 4991 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 4992 if source.Time != nil { 4993 values = append(values, source.Time) 4994 } 4995 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 4996 values = append(values, source.RegionId) 4997 default: 4998 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", fp.selector)) 4999 } 5000 } 5001 return 5002 } 5003 5004 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 5005 return fp.Get(source.(*ActivityLog_Event_RegionalServerMsgEvent)) 5006 } 5007 5008 // GetSingle returns value pointed by specific field of from source ActivityLog_Event_RegionalServerMsgEvent 5009 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) GetSingle(source *ActivityLog_Event_RegionalServerMsgEvent) (interface{}, bool) { 5010 switch fp.selector { 5011 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 5012 res := source.GetData() 5013 return res, res != nil 5014 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 5015 res := source.GetTime() 5016 return res, res != nil 5017 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 5018 return source.GetRegionId(), source != nil 5019 default: 5020 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", fp.selector)) 5021 } 5022 } 5023 5024 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 5025 return fp.GetSingle(source.(*ActivityLog_Event_RegionalServerMsgEvent)) 5026 } 5027 5028 // GetDefault returns a default value of the field type 5029 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) GetDefault() interface{} { 5030 switch fp.selector { 5031 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 5032 return (*anypb.Any)(nil) 5033 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 5034 return (*timestamppb.Timestamp)(nil) 5035 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 5036 return "" 5037 default: 5038 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", fp.selector)) 5039 } 5040 } 5041 5042 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) ClearValue(item *ActivityLog_Event_RegionalServerMsgEvent) { 5043 if item != nil { 5044 switch fp.selector { 5045 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 5046 item.Data = nil 5047 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 5048 item.Time = nil 5049 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 5050 item.RegionId = "" 5051 default: 5052 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", fp.selector)) 5053 } 5054 } 5055 } 5056 5057 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) ClearValueRaw(item proto.Message) { 5058 fp.ClearValue(item.(*ActivityLog_Event_RegionalServerMsgEvent)) 5059 } 5060 5061 // IsLeaf - whether field path is holds simple value 5062 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) IsLeaf() bool { 5063 return fp.selector == ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData || 5064 fp.selector == ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime || 5065 fp.selector == ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId 5066 } 5067 5068 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 5069 return []gotenobject.FieldPath{fp} 5070 } 5071 5072 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) WithIValue(value interface{}) ActivityLogEventRegionalServerMsgEvent_FieldPathValue { 5073 switch fp.selector { 5074 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 5075 return &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue{ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath: *fp, value: value.(*anypb.Any)} 5076 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 5077 return &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue{ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath: *fp, value: value.(*timestamppb.Timestamp)} 5078 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 5079 return &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue{ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath: *fp, value: value.(string)} 5080 default: 5081 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", fp.selector)) 5082 } 5083 } 5084 5085 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 5086 return fp.WithIValue(value) 5087 } 5088 5089 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues { 5090 fpaov := &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath: *fp} 5091 switch fp.selector { 5092 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 5093 return &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath: *fp, values: values.([]*anypb.Any)} 5094 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 5095 return &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath: *fp, values: values.([]*timestamppb.Timestamp)} 5096 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 5097 return &ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath: *fp, values: values.([]string)} 5098 default: 5099 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", fp.selector)) 5100 } 5101 return fpaov 5102 } 5103 5104 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 5105 return fp.WithIArrayOfValues(values) 5106 } 5107 5108 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue { 5109 switch fp.selector { 5110 default: 5111 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", fp.selector)) 5112 } 5113 } 5114 5115 func (fp *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 5116 return fp.WithIArrayItemValue(value) 5117 } 5118 5119 // ActivityLogEventRegionalServerMsgEvent_FieldPathValue allows storing values for RegionalServerMsgEvent fields according to their type 5120 type ActivityLogEventRegionalServerMsgEvent_FieldPathValue interface { 5121 ActivityLogEventRegionalServerMsgEvent_FieldPath 5122 gotenobject.FieldPathValue 5123 SetTo(target **ActivityLog_Event_RegionalServerMsgEvent) 5124 CompareWith(*ActivityLog_Event_RegionalServerMsgEvent) (cmp int, comparable bool) 5125 } 5126 5127 func ParseActivityLogEventRegionalServerMsgEvent_FieldPathValue(pathStr, valueStr string) (ActivityLogEventRegionalServerMsgEvent_FieldPathValue, error) { 5128 fp, err := ParseActivityLogEventRegionalServerMsgEvent_FieldPath(pathStr) 5129 if err != nil { 5130 return nil, err 5131 } 5132 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 5133 if err != nil { 5134 return nil, status.Errorf(codes.InvalidArgument, "error parsing RegionalServerMsgEvent field path value from %s: %v", valueStr, err) 5135 } 5136 return fpv.(ActivityLogEventRegionalServerMsgEvent_FieldPathValue), nil 5137 } 5138 5139 func MustParseActivityLogEventRegionalServerMsgEvent_FieldPathValue(pathStr, valueStr string) ActivityLogEventRegionalServerMsgEvent_FieldPathValue { 5140 fpv, err := ParseActivityLogEventRegionalServerMsgEvent_FieldPathValue(pathStr, valueStr) 5141 if err != nil { 5142 panic(err) 5143 } 5144 return fpv 5145 } 5146 5147 type ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue struct { 5148 ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath 5149 value interface{} 5150 } 5151 5152 var _ ActivityLogEventRegionalServerMsgEvent_FieldPathValue = (*ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue)(nil) 5153 5154 // GetRawValue returns raw value stored under selected path for 'RegionalServerMsgEvent' as interface{} 5155 func (fpv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue) GetRawValue() interface{} { 5156 return fpv.value 5157 } 5158 func (fpv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue) AsDataValue() (*anypb.Any, bool) { 5159 res, ok := fpv.value.(*anypb.Any) 5160 return res, ok 5161 } 5162 func (fpv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue) AsTimeValue() (*timestamppb.Timestamp, bool) { 5163 res, ok := fpv.value.(*timestamppb.Timestamp) 5164 return res, ok 5165 } 5166 func (fpv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue) AsRegionIdValue() (string, bool) { 5167 res, ok := fpv.value.(string) 5168 return res, ok 5169 } 5170 5171 // SetTo stores value for selected field for object RegionalServerMsgEvent 5172 func (fpv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue) SetTo(target **ActivityLog_Event_RegionalServerMsgEvent) { 5173 if *target == nil { 5174 *target = new(ActivityLog_Event_RegionalServerMsgEvent) 5175 } 5176 switch fpv.selector { 5177 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 5178 (*target).Data = fpv.value.(*anypb.Any) 5179 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 5180 (*target).Time = fpv.value.(*timestamppb.Timestamp) 5181 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 5182 (*target).RegionId = fpv.value.(string) 5183 default: 5184 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", fpv.selector)) 5185 } 5186 } 5187 5188 func (fpv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue) SetToRaw(target proto.Message) { 5189 typedObject := target.(*ActivityLog_Event_RegionalServerMsgEvent) 5190 fpv.SetTo(&typedObject) 5191 } 5192 5193 // CompareWith compares value in the 'ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue' with the value under path in 'ActivityLog_Event_RegionalServerMsgEvent'. 5194 func (fpv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue) CompareWith(source *ActivityLog_Event_RegionalServerMsgEvent) (int, bool) { 5195 switch fpv.selector { 5196 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 5197 return 0, false 5198 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 5199 leftValue := fpv.value.(*timestamppb.Timestamp) 5200 rightValue := source.GetTime() 5201 if leftValue == nil { 5202 if rightValue != nil { 5203 return -1, true 5204 } 5205 return 0, true 5206 } 5207 if rightValue == nil { 5208 return 1, true 5209 } 5210 if leftValue.AsTime().Equal(rightValue.AsTime()) { 5211 return 0, true 5212 } else if leftValue.AsTime().Before(rightValue.AsTime()) { 5213 return -1, true 5214 } else { 5215 return 1, true 5216 } 5217 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 5218 leftValue := fpv.value.(string) 5219 rightValue := source.GetRegionId() 5220 if (leftValue) == (rightValue) { 5221 return 0, true 5222 } else if (leftValue) < (rightValue) { 5223 return -1, true 5224 } else { 5225 return 1, true 5226 } 5227 default: 5228 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalServerMsgEvent: %d", fpv.selector)) 5229 } 5230 } 5231 5232 func (fpv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 5233 return fpv.CompareWith(source.(*ActivityLog_Event_RegionalServerMsgEvent)) 5234 } 5235 5236 // ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue allows storing single item in Path-specific values for RegionalServerMsgEvent according to their type 5237 // Present only for array (repeated) types. 5238 type ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue interface { 5239 gotenobject.FieldPathArrayItemValue 5240 ActivityLogEventRegionalServerMsgEvent_FieldPath 5241 ContainsValue(*ActivityLog_Event_RegionalServerMsgEvent) bool 5242 } 5243 5244 // ParseActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 5245 func ParseActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue, error) { 5246 fp, err := ParseActivityLogEventRegionalServerMsgEvent_FieldPath(pathStr) 5247 if err != nil { 5248 return nil, err 5249 } 5250 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 5251 if err != nil { 5252 return nil, status.Errorf(codes.InvalidArgument, "error parsing RegionalServerMsgEvent field path array item value from %s: %v", valueStr, err) 5253 } 5254 return fpaiv.(ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue), nil 5255 } 5256 5257 func MustParseActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue { 5258 fpaiv, err := ParseActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue(pathStr, valueStr) 5259 if err != nil { 5260 panic(err) 5261 } 5262 return fpaiv 5263 } 5264 5265 type ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayItemValue struct { 5266 ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath 5267 value interface{} 5268 } 5269 5270 var _ ActivityLogEventRegionalServerMsgEvent_FieldPathArrayItemValue = (*ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayItemValue)(nil) 5271 5272 // GetRawValue returns stored element value for array in object ActivityLog_Event_RegionalServerMsgEvent as interface{} 5273 func (fpaiv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 5274 return fpaiv.value 5275 } 5276 5277 func (fpaiv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_Event_RegionalServerMsgEvent) (interface{}, bool) { 5278 return nil, false 5279 } 5280 5281 func (fpaiv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 5282 return fpaiv.GetSingle(source.(*ActivityLog_Event_RegionalServerMsgEvent)) 5283 } 5284 5285 // Contains returns a boolean indicating if value that is being held is present in given 'RegionalServerMsgEvent' 5286 func (fpaiv *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_Event_RegionalServerMsgEvent) bool { 5287 slice := fpaiv.ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath.Get(source) 5288 for _, v := range slice { 5289 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 5290 if proto.Equal(asProtoMsg, v.(proto.Message)) { 5291 return true 5292 } 5293 } else if reflect.DeepEqual(v, fpaiv.value) { 5294 return true 5295 } 5296 } 5297 return false 5298 } 5299 5300 // ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues allows storing slice of values for RegionalServerMsgEvent fields according to their type 5301 type ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues interface { 5302 gotenobject.FieldPathArrayOfValues 5303 ActivityLogEventRegionalServerMsgEvent_FieldPath 5304 } 5305 5306 func ParseActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues, error) { 5307 fp, err := ParseActivityLogEventRegionalServerMsgEvent_FieldPath(pathStr) 5308 if err != nil { 5309 return nil, err 5310 } 5311 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 5312 if err != nil { 5313 return nil, status.Errorf(codes.InvalidArgument, "error parsing RegionalServerMsgEvent field path array of values from %s: %v", valuesStr, err) 5314 } 5315 return fpaov.(ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues), nil 5316 } 5317 5318 func MustParseActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues { 5319 fpaov, err := ParseActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues(pathStr, valuesStr) 5320 if err != nil { 5321 panic(err) 5322 } 5323 return fpaov 5324 } 5325 5326 type ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues struct { 5327 ActivityLogEventRegionalServerMsgEvent_FieldTerminalPath 5328 values interface{} 5329 } 5330 5331 var _ ActivityLogEventRegionalServerMsgEvent_FieldPathArrayOfValues = (*ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues)(nil) 5332 5333 func (fpaov *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 5334 switch fpaov.selector { 5335 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorData: 5336 for _, v := range fpaov.values.([]*anypb.Any) { 5337 values = append(values, v) 5338 } 5339 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorTime: 5340 for _, v := range fpaov.values.([]*timestamppb.Timestamp) { 5341 values = append(values, v) 5342 } 5343 case ActivityLogEventRegionalServerMsgEvent_FieldPathSelectorRegionId: 5344 for _, v := range fpaov.values.([]string) { 5345 values = append(values, v) 5346 } 5347 } 5348 return 5349 } 5350 func (fpaov *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues) AsDataArrayOfValues() ([]*anypb.Any, bool) { 5351 res, ok := fpaov.values.([]*anypb.Any) 5352 return res, ok 5353 } 5354 func (fpaov *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues) AsTimeArrayOfValues() ([]*timestamppb.Timestamp, bool) { 5355 res, ok := fpaov.values.([]*timestamppb.Timestamp) 5356 return res, ok 5357 } 5358 func (fpaov *ActivityLogEventRegionalServerMsgEvent_FieldTerminalPathArrayOfValues) AsRegionIdArrayOfValues() ([]string, bool) { 5359 res, ok := fpaov.values.([]string) 5360 return res, ok 5361 } 5362 5363 // FieldPath provides implementation to handle 5364 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 5365 type ActivityLogEventServerMsgEvent_FieldPath interface { 5366 gotenobject.FieldPath 5367 Selector() ActivityLogEventServerMsgEvent_FieldPathSelector 5368 Get(source *ActivityLog_Event_ServerMsgEvent) []interface{} 5369 GetSingle(source *ActivityLog_Event_ServerMsgEvent) (interface{}, bool) 5370 ClearValue(item *ActivityLog_Event_ServerMsgEvent) 5371 5372 // Those methods build corresponding ActivityLogEventServerMsgEvent_FieldPathValue 5373 // (or array of values) and holds passed value. Panics if injected type is incorrect. 5374 WithIValue(value interface{}) ActivityLogEventServerMsgEvent_FieldPathValue 5375 WithIArrayOfValues(values interface{}) ActivityLogEventServerMsgEvent_FieldPathArrayOfValues 5376 WithIArrayItemValue(value interface{}) ActivityLogEventServerMsgEvent_FieldPathArrayItemValue 5377 } 5378 5379 type ActivityLogEventServerMsgEvent_FieldPathSelector int32 5380 5381 const ( 5382 ActivityLogEventServerMsgEvent_FieldPathSelectorData ActivityLogEventServerMsgEvent_FieldPathSelector = 0 5383 ActivityLogEventServerMsgEvent_FieldPathSelectorTime ActivityLogEventServerMsgEvent_FieldPathSelector = 1 5384 ) 5385 5386 func (s ActivityLogEventServerMsgEvent_FieldPathSelector) String() string { 5387 switch s { 5388 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5389 return "data" 5390 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5391 return "time" 5392 default: 5393 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", s)) 5394 } 5395 } 5396 5397 func BuildActivityLogEventServerMsgEvent_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogEventServerMsgEvent_FieldPath, error) { 5398 if len(fp) == 0 { 5399 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_Event_ServerMsgEvent") 5400 } 5401 if len(fp) == 1 { 5402 switch fp[0] { 5403 case "data": 5404 return &ActivityLogEventServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventServerMsgEvent_FieldPathSelectorData}, nil 5405 case "time": 5406 return &ActivityLogEventServerMsgEvent_FieldTerminalPath{selector: ActivityLogEventServerMsgEvent_FieldPathSelectorTime}, nil 5407 } 5408 } 5409 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_Event_ServerMsgEvent", fp) 5410 } 5411 5412 func ParseActivityLogEventServerMsgEvent_FieldPath(rawField string) (ActivityLogEventServerMsgEvent_FieldPath, error) { 5413 fp, err := gotenobject.ParseRawFieldPath(rawField) 5414 if err != nil { 5415 return nil, err 5416 } 5417 return BuildActivityLogEventServerMsgEvent_FieldPath(fp) 5418 } 5419 5420 func MustParseActivityLogEventServerMsgEvent_FieldPath(rawField string) ActivityLogEventServerMsgEvent_FieldPath { 5421 fp, err := ParseActivityLogEventServerMsgEvent_FieldPath(rawField) 5422 if err != nil { 5423 panic(err) 5424 } 5425 return fp 5426 } 5427 5428 type ActivityLogEventServerMsgEvent_FieldTerminalPath struct { 5429 selector ActivityLogEventServerMsgEvent_FieldPathSelector 5430 } 5431 5432 var _ ActivityLogEventServerMsgEvent_FieldPath = (*ActivityLogEventServerMsgEvent_FieldTerminalPath)(nil) 5433 5434 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) Selector() ActivityLogEventServerMsgEvent_FieldPathSelector { 5435 return fp.selector 5436 } 5437 5438 // String returns path representation in proto convention 5439 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) String() string { 5440 return fp.selector.String() 5441 } 5442 5443 // JSONString returns path representation is JSON convention 5444 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) JSONString() string { 5445 return strcase.ToLowerCamel(fp.String()) 5446 } 5447 5448 // Get returns all values pointed by specific field from source ActivityLog_Event_ServerMsgEvent 5449 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) Get(source *ActivityLog_Event_ServerMsgEvent) (values []interface{}) { 5450 if source != nil { 5451 switch fp.selector { 5452 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5453 if source.Data != nil { 5454 values = append(values, source.Data) 5455 } 5456 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5457 if source.Time != nil { 5458 values = append(values, source.Time) 5459 } 5460 default: 5461 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", fp.selector)) 5462 } 5463 } 5464 return 5465 } 5466 5467 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 5468 return fp.Get(source.(*ActivityLog_Event_ServerMsgEvent)) 5469 } 5470 5471 // GetSingle returns value pointed by specific field of from source ActivityLog_Event_ServerMsgEvent 5472 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) GetSingle(source *ActivityLog_Event_ServerMsgEvent) (interface{}, bool) { 5473 switch fp.selector { 5474 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5475 res := source.GetData() 5476 return res, res != nil 5477 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5478 res := source.GetTime() 5479 return res, res != nil 5480 default: 5481 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", fp.selector)) 5482 } 5483 } 5484 5485 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 5486 return fp.GetSingle(source.(*ActivityLog_Event_ServerMsgEvent)) 5487 } 5488 5489 // GetDefault returns a default value of the field type 5490 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) GetDefault() interface{} { 5491 switch fp.selector { 5492 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5493 return (*anypb.Any)(nil) 5494 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5495 return (*timestamppb.Timestamp)(nil) 5496 default: 5497 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", fp.selector)) 5498 } 5499 } 5500 5501 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) ClearValue(item *ActivityLog_Event_ServerMsgEvent) { 5502 if item != nil { 5503 switch fp.selector { 5504 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5505 item.Data = nil 5506 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5507 item.Time = nil 5508 default: 5509 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", fp.selector)) 5510 } 5511 } 5512 } 5513 5514 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) ClearValueRaw(item proto.Message) { 5515 fp.ClearValue(item.(*ActivityLog_Event_ServerMsgEvent)) 5516 } 5517 5518 // IsLeaf - whether field path is holds simple value 5519 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) IsLeaf() bool { 5520 return fp.selector == ActivityLogEventServerMsgEvent_FieldPathSelectorData || 5521 fp.selector == ActivityLogEventServerMsgEvent_FieldPathSelectorTime 5522 } 5523 5524 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 5525 return []gotenobject.FieldPath{fp} 5526 } 5527 5528 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) WithIValue(value interface{}) ActivityLogEventServerMsgEvent_FieldPathValue { 5529 switch fp.selector { 5530 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5531 return &ActivityLogEventServerMsgEvent_FieldTerminalPathValue{ActivityLogEventServerMsgEvent_FieldTerminalPath: *fp, value: value.(*anypb.Any)} 5532 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5533 return &ActivityLogEventServerMsgEvent_FieldTerminalPathValue{ActivityLogEventServerMsgEvent_FieldTerminalPath: *fp, value: value.(*timestamppb.Timestamp)} 5534 default: 5535 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", fp.selector)) 5536 } 5537 } 5538 5539 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 5540 return fp.WithIValue(value) 5541 } 5542 5543 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogEventServerMsgEvent_FieldPathArrayOfValues { 5544 fpaov := &ActivityLogEventServerMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventServerMsgEvent_FieldTerminalPath: *fp} 5545 switch fp.selector { 5546 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5547 return &ActivityLogEventServerMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventServerMsgEvent_FieldTerminalPath: *fp, values: values.([]*anypb.Any)} 5548 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5549 return &ActivityLogEventServerMsgEvent_FieldTerminalPathArrayOfValues{ActivityLogEventServerMsgEvent_FieldTerminalPath: *fp, values: values.([]*timestamppb.Timestamp)} 5550 default: 5551 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", fp.selector)) 5552 } 5553 return fpaov 5554 } 5555 5556 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 5557 return fp.WithIArrayOfValues(values) 5558 } 5559 5560 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogEventServerMsgEvent_FieldPathArrayItemValue { 5561 switch fp.selector { 5562 default: 5563 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", fp.selector)) 5564 } 5565 } 5566 5567 func (fp *ActivityLogEventServerMsgEvent_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 5568 return fp.WithIArrayItemValue(value) 5569 } 5570 5571 // ActivityLogEventServerMsgEvent_FieldPathValue allows storing values for ServerMsgEvent fields according to their type 5572 type ActivityLogEventServerMsgEvent_FieldPathValue interface { 5573 ActivityLogEventServerMsgEvent_FieldPath 5574 gotenobject.FieldPathValue 5575 SetTo(target **ActivityLog_Event_ServerMsgEvent) 5576 CompareWith(*ActivityLog_Event_ServerMsgEvent) (cmp int, comparable bool) 5577 } 5578 5579 func ParseActivityLogEventServerMsgEvent_FieldPathValue(pathStr, valueStr string) (ActivityLogEventServerMsgEvent_FieldPathValue, error) { 5580 fp, err := ParseActivityLogEventServerMsgEvent_FieldPath(pathStr) 5581 if err != nil { 5582 return nil, err 5583 } 5584 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 5585 if err != nil { 5586 return nil, status.Errorf(codes.InvalidArgument, "error parsing ServerMsgEvent field path value from %s: %v", valueStr, err) 5587 } 5588 return fpv.(ActivityLogEventServerMsgEvent_FieldPathValue), nil 5589 } 5590 5591 func MustParseActivityLogEventServerMsgEvent_FieldPathValue(pathStr, valueStr string) ActivityLogEventServerMsgEvent_FieldPathValue { 5592 fpv, err := ParseActivityLogEventServerMsgEvent_FieldPathValue(pathStr, valueStr) 5593 if err != nil { 5594 panic(err) 5595 } 5596 return fpv 5597 } 5598 5599 type ActivityLogEventServerMsgEvent_FieldTerminalPathValue struct { 5600 ActivityLogEventServerMsgEvent_FieldTerminalPath 5601 value interface{} 5602 } 5603 5604 var _ ActivityLogEventServerMsgEvent_FieldPathValue = (*ActivityLogEventServerMsgEvent_FieldTerminalPathValue)(nil) 5605 5606 // GetRawValue returns raw value stored under selected path for 'ServerMsgEvent' as interface{} 5607 func (fpv *ActivityLogEventServerMsgEvent_FieldTerminalPathValue) GetRawValue() interface{} { 5608 return fpv.value 5609 } 5610 func (fpv *ActivityLogEventServerMsgEvent_FieldTerminalPathValue) AsDataValue() (*anypb.Any, bool) { 5611 res, ok := fpv.value.(*anypb.Any) 5612 return res, ok 5613 } 5614 func (fpv *ActivityLogEventServerMsgEvent_FieldTerminalPathValue) AsTimeValue() (*timestamppb.Timestamp, bool) { 5615 res, ok := fpv.value.(*timestamppb.Timestamp) 5616 return res, ok 5617 } 5618 5619 // SetTo stores value for selected field for object ServerMsgEvent 5620 func (fpv *ActivityLogEventServerMsgEvent_FieldTerminalPathValue) SetTo(target **ActivityLog_Event_ServerMsgEvent) { 5621 if *target == nil { 5622 *target = new(ActivityLog_Event_ServerMsgEvent) 5623 } 5624 switch fpv.selector { 5625 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5626 (*target).Data = fpv.value.(*anypb.Any) 5627 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5628 (*target).Time = fpv.value.(*timestamppb.Timestamp) 5629 default: 5630 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", fpv.selector)) 5631 } 5632 } 5633 5634 func (fpv *ActivityLogEventServerMsgEvent_FieldTerminalPathValue) SetToRaw(target proto.Message) { 5635 typedObject := target.(*ActivityLog_Event_ServerMsgEvent) 5636 fpv.SetTo(&typedObject) 5637 } 5638 5639 // CompareWith compares value in the 'ActivityLogEventServerMsgEvent_FieldTerminalPathValue' with the value under path in 'ActivityLog_Event_ServerMsgEvent'. 5640 func (fpv *ActivityLogEventServerMsgEvent_FieldTerminalPathValue) CompareWith(source *ActivityLog_Event_ServerMsgEvent) (int, bool) { 5641 switch fpv.selector { 5642 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5643 return 0, false 5644 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5645 leftValue := fpv.value.(*timestamppb.Timestamp) 5646 rightValue := source.GetTime() 5647 if leftValue == nil { 5648 if rightValue != nil { 5649 return -1, true 5650 } 5651 return 0, true 5652 } 5653 if rightValue == nil { 5654 return 1, true 5655 } 5656 if leftValue.AsTime().Equal(rightValue.AsTime()) { 5657 return 0, true 5658 } else if leftValue.AsTime().Before(rightValue.AsTime()) { 5659 return -1, true 5660 } else { 5661 return 1, true 5662 } 5663 default: 5664 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ServerMsgEvent: %d", fpv.selector)) 5665 } 5666 } 5667 5668 func (fpv *ActivityLogEventServerMsgEvent_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 5669 return fpv.CompareWith(source.(*ActivityLog_Event_ServerMsgEvent)) 5670 } 5671 5672 // ActivityLogEventServerMsgEvent_FieldPathArrayItemValue allows storing single item in Path-specific values for ServerMsgEvent according to their type 5673 // Present only for array (repeated) types. 5674 type ActivityLogEventServerMsgEvent_FieldPathArrayItemValue interface { 5675 gotenobject.FieldPathArrayItemValue 5676 ActivityLogEventServerMsgEvent_FieldPath 5677 ContainsValue(*ActivityLog_Event_ServerMsgEvent) bool 5678 } 5679 5680 // ParseActivityLogEventServerMsgEvent_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 5681 func ParseActivityLogEventServerMsgEvent_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogEventServerMsgEvent_FieldPathArrayItemValue, error) { 5682 fp, err := ParseActivityLogEventServerMsgEvent_FieldPath(pathStr) 5683 if err != nil { 5684 return nil, err 5685 } 5686 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 5687 if err != nil { 5688 return nil, status.Errorf(codes.InvalidArgument, "error parsing ServerMsgEvent field path array item value from %s: %v", valueStr, err) 5689 } 5690 return fpaiv.(ActivityLogEventServerMsgEvent_FieldPathArrayItemValue), nil 5691 } 5692 5693 func MustParseActivityLogEventServerMsgEvent_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogEventServerMsgEvent_FieldPathArrayItemValue { 5694 fpaiv, err := ParseActivityLogEventServerMsgEvent_FieldPathArrayItemValue(pathStr, valueStr) 5695 if err != nil { 5696 panic(err) 5697 } 5698 return fpaiv 5699 } 5700 5701 type ActivityLogEventServerMsgEvent_FieldTerminalPathArrayItemValue struct { 5702 ActivityLogEventServerMsgEvent_FieldTerminalPath 5703 value interface{} 5704 } 5705 5706 var _ ActivityLogEventServerMsgEvent_FieldPathArrayItemValue = (*ActivityLogEventServerMsgEvent_FieldTerminalPathArrayItemValue)(nil) 5707 5708 // GetRawValue returns stored element value for array in object ActivityLog_Event_ServerMsgEvent as interface{} 5709 func (fpaiv *ActivityLogEventServerMsgEvent_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 5710 return fpaiv.value 5711 } 5712 5713 func (fpaiv *ActivityLogEventServerMsgEvent_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_Event_ServerMsgEvent) (interface{}, bool) { 5714 return nil, false 5715 } 5716 5717 func (fpaiv *ActivityLogEventServerMsgEvent_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 5718 return fpaiv.GetSingle(source.(*ActivityLog_Event_ServerMsgEvent)) 5719 } 5720 5721 // Contains returns a boolean indicating if value that is being held is present in given 'ServerMsgEvent' 5722 func (fpaiv *ActivityLogEventServerMsgEvent_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_Event_ServerMsgEvent) bool { 5723 slice := fpaiv.ActivityLogEventServerMsgEvent_FieldTerminalPath.Get(source) 5724 for _, v := range slice { 5725 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 5726 if proto.Equal(asProtoMsg, v.(proto.Message)) { 5727 return true 5728 } 5729 } else if reflect.DeepEqual(v, fpaiv.value) { 5730 return true 5731 } 5732 } 5733 return false 5734 } 5735 5736 // ActivityLogEventServerMsgEvent_FieldPathArrayOfValues allows storing slice of values for ServerMsgEvent fields according to their type 5737 type ActivityLogEventServerMsgEvent_FieldPathArrayOfValues interface { 5738 gotenobject.FieldPathArrayOfValues 5739 ActivityLogEventServerMsgEvent_FieldPath 5740 } 5741 5742 func ParseActivityLogEventServerMsgEvent_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogEventServerMsgEvent_FieldPathArrayOfValues, error) { 5743 fp, err := ParseActivityLogEventServerMsgEvent_FieldPath(pathStr) 5744 if err != nil { 5745 return nil, err 5746 } 5747 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 5748 if err != nil { 5749 return nil, status.Errorf(codes.InvalidArgument, "error parsing ServerMsgEvent field path array of values from %s: %v", valuesStr, err) 5750 } 5751 return fpaov.(ActivityLogEventServerMsgEvent_FieldPathArrayOfValues), nil 5752 } 5753 5754 func MustParseActivityLogEventServerMsgEvent_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogEventServerMsgEvent_FieldPathArrayOfValues { 5755 fpaov, err := ParseActivityLogEventServerMsgEvent_FieldPathArrayOfValues(pathStr, valuesStr) 5756 if err != nil { 5757 panic(err) 5758 } 5759 return fpaov 5760 } 5761 5762 type ActivityLogEventServerMsgEvent_FieldTerminalPathArrayOfValues struct { 5763 ActivityLogEventServerMsgEvent_FieldTerminalPath 5764 values interface{} 5765 } 5766 5767 var _ ActivityLogEventServerMsgEvent_FieldPathArrayOfValues = (*ActivityLogEventServerMsgEvent_FieldTerminalPathArrayOfValues)(nil) 5768 5769 func (fpaov *ActivityLogEventServerMsgEvent_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 5770 switch fpaov.selector { 5771 case ActivityLogEventServerMsgEvent_FieldPathSelectorData: 5772 for _, v := range fpaov.values.([]*anypb.Any) { 5773 values = append(values, v) 5774 } 5775 case ActivityLogEventServerMsgEvent_FieldPathSelectorTime: 5776 for _, v := range fpaov.values.([]*timestamppb.Timestamp) { 5777 values = append(values, v) 5778 } 5779 } 5780 return 5781 } 5782 func (fpaov *ActivityLogEventServerMsgEvent_FieldTerminalPathArrayOfValues) AsDataArrayOfValues() ([]*anypb.Any, bool) { 5783 res, ok := fpaov.values.([]*anypb.Any) 5784 return res, ok 5785 } 5786 func (fpaov *ActivityLogEventServerMsgEvent_FieldTerminalPathArrayOfValues) AsTimeArrayOfValues() ([]*timestamppb.Timestamp, bool) { 5787 res, ok := fpaov.values.([]*timestamppb.Timestamp) 5788 return res, ok 5789 } 5790 5791 // FieldPath provides implementation to handle 5792 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 5793 type ActivityLogEventRegionalExitEvent_FieldPath interface { 5794 gotenobject.FieldPath 5795 Selector() ActivityLogEventRegionalExitEvent_FieldPathSelector 5796 Get(source *ActivityLog_Event_RegionalExitEvent) []interface{} 5797 GetSingle(source *ActivityLog_Event_RegionalExitEvent) (interface{}, bool) 5798 ClearValue(item *ActivityLog_Event_RegionalExitEvent) 5799 5800 // Those methods build corresponding ActivityLogEventRegionalExitEvent_FieldPathValue 5801 // (or array of values) and holds passed value. Panics if injected type is incorrect. 5802 WithIValue(value interface{}) ActivityLogEventRegionalExitEvent_FieldPathValue 5803 WithIArrayOfValues(values interface{}) ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues 5804 WithIArrayItemValue(value interface{}) ActivityLogEventRegionalExitEvent_FieldPathArrayItemValue 5805 } 5806 5807 type ActivityLogEventRegionalExitEvent_FieldPathSelector int32 5808 5809 const ( 5810 ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus ActivityLogEventRegionalExitEvent_FieldPathSelector = 0 5811 ActivityLogEventRegionalExitEvent_FieldPathSelectorTime ActivityLogEventRegionalExitEvent_FieldPathSelector = 1 5812 ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId ActivityLogEventRegionalExitEvent_FieldPathSelector = 2 5813 ) 5814 5815 func (s ActivityLogEventRegionalExitEvent_FieldPathSelector) String() string { 5816 switch s { 5817 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 5818 return "status" 5819 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 5820 return "time" 5821 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 5822 return "region_id" 5823 default: 5824 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", s)) 5825 } 5826 } 5827 5828 func BuildActivityLogEventRegionalExitEvent_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogEventRegionalExitEvent_FieldPath, error) { 5829 if len(fp) == 0 { 5830 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_Event_RegionalExitEvent") 5831 } 5832 if len(fp) == 1 { 5833 switch fp[0] { 5834 case "status": 5835 return &ActivityLogEventRegionalExitEvent_FieldTerminalPath{selector: ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus}, nil 5836 case "time": 5837 return &ActivityLogEventRegionalExitEvent_FieldTerminalPath{selector: ActivityLogEventRegionalExitEvent_FieldPathSelectorTime}, nil 5838 case "region_id", "regionId", "region-id": 5839 return &ActivityLogEventRegionalExitEvent_FieldTerminalPath{selector: ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId}, nil 5840 } 5841 } else { 5842 switch fp[0] { 5843 case "status": 5844 if subpath, err := rpc.BuildStatus_FieldPath(fp[1:]); err != nil { 5845 return nil, err 5846 } else { 5847 return &ActivityLogEventRegionalExitEvent_FieldSubPath{selector: ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus, subPath: subpath}, nil 5848 } 5849 } 5850 } 5851 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_Event_RegionalExitEvent", fp) 5852 } 5853 5854 func ParseActivityLogEventRegionalExitEvent_FieldPath(rawField string) (ActivityLogEventRegionalExitEvent_FieldPath, error) { 5855 fp, err := gotenobject.ParseRawFieldPath(rawField) 5856 if err != nil { 5857 return nil, err 5858 } 5859 return BuildActivityLogEventRegionalExitEvent_FieldPath(fp) 5860 } 5861 5862 func MustParseActivityLogEventRegionalExitEvent_FieldPath(rawField string) ActivityLogEventRegionalExitEvent_FieldPath { 5863 fp, err := ParseActivityLogEventRegionalExitEvent_FieldPath(rawField) 5864 if err != nil { 5865 panic(err) 5866 } 5867 return fp 5868 } 5869 5870 type ActivityLogEventRegionalExitEvent_FieldTerminalPath struct { 5871 selector ActivityLogEventRegionalExitEvent_FieldPathSelector 5872 } 5873 5874 var _ ActivityLogEventRegionalExitEvent_FieldPath = (*ActivityLogEventRegionalExitEvent_FieldTerminalPath)(nil) 5875 5876 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) Selector() ActivityLogEventRegionalExitEvent_FieldPathSelector { 5877 return fp.selector 5878 } 5879 5880 // String returns path representation in proto convention 5881 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) String() string { 5882 return fp.selector.String() 5883 } 5884 5885 // JSONString returns path representation is JSON convention 5886 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) JSONString() string { 5887 return strcase.ToLowerCamel(fp.String()) 5888 } 5889 5890 // Get returns all values pointed by specific field from source ActivityLog_Event_RegionalExitEvent 5891 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) Get(source *ActivityLog_Event_RegionalExitEvent) (values []interface{}) { 5892 if source != nil { 5893 switch fp.selector { 5894 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 5895 if source.Status != nil { 5896 values = append(values, source.Status) 5897 } 5898 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 5899 if source.Time != nil { 5900 values = append(values, source.Time) 5901 } 5902 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 5903 values = append(values, source.RegionId) 5904 default: 5905 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fp.selector)) 5906 } 5907 } 5908 return 5909 } 5910 5911 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 5912 return fp.Get(source.(*ActivityLog_Event_RegionalExitEvent)) 5913 } 5914 5915 // GetSingle returns value pointed by specific field of from source ActivityLog_Event_RegionalExitEvent 5916 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) GetSingle(source *ActivityLog_Event_RegionalExitEvent) (interface{}, bool) { 5917 switch fp.selector { 5918 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 5919 res := source.GetStatus() 5920 return res, res != nil 5921 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 5922 res := source.GetTime() 5923 return res, res != nil 5924 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 5925 return source.GetRegionId(), source != nil 5926 default: 5927 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fp.selector)) 5928 } 5929 } 5930 5931 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 5932 return fp.GetSingle(source.(*ActivityLog_Event_RegionalExitEvent)) 5933 } 5934 5935 // GetDefault returns a default value of the field type 5936 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) GetDefault() interface{} { 5937 switch fp.selector { 5938 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 5939 return (*rpc.Status)(nil) 5940 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 5941 return (*timestamppb.Timestamp)(nil) 5942 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 5943 return "" 5944 default: 5945 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fp.selector)) 5946 } 5947 } 5948 5949 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) ClearValue(item *ActivityLog_Event_RegionalExitEvent) { 5950 if item != nil { 5951 switch fp.selector { 5952 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 5953 item.Status = nil 5954 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 5955 item.Time = nil 5956 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 5957 item.RegionId = "" 5958 default: 5959 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fp.selector)) 5960 } 5961 } 5962 } 5963 5964 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) ClearValueRaw(item proto.Message) { 5965 fp.ClearValue(item.(*ActivityLog_Event_RegionalExitEvent)) 5966 } 5967 5968 // IsLeaf - whether field path is holds simple value 5969 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) IsLeaf() bool { 5970 return fp.selector == ActivityLogEventRegionalExitEvent_FieldPathSelectorTime || 5971 fp.selector == ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId 5972 } 5973 5974 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 5975 return []gotenobject.FieldPath{fp} 5976 } 5977 5978 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) WithIValue(value interface{}) ActivityLogEventRegionalExitEvent_FieldPathValue { 5979 switch fp.selector { 5980 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 5981 return &ActivityLogEventRegionalExitEvent_FieldTerminalPathValue{ActivityLogEventRegionalExitEvent_FieldTerminalPath: *fp, value: value.(*rpc.Status)} 5982 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 5983 return &ActivityLogEventRegionalExitEvent_FieldTerminalPathValue{ActivityLogEventRegionalExitEvent_FieldTerminalPath: *fp, value: value.(*timestamppb.Timestamp)} 5984 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 5985 return &ActivityLogEventRegionalExitEvent_FieldTerminalPathValue{ActivityLogEventRegionalExitEvent_FieldTerminalPath: *fp, value: value.(string)} 5986 default: 5987 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fp.selector)) 5988 } 5989 } 5990 5991 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 5992 return fp.WithIValue(value) 5993 } 5994 5995 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues { 5996 fpaov := &ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues{ActivityLogEventRegionalExitEvent_FieldTerminalPath: *fp} 5997 switch fp.selector { 5998 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 5999 return &ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues{ActivityLogEventRegionalExitEvent_FieldTerminalPath: *fp, values: values.([]*rpc.Status)} 6000 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 6001 return &ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues{ActivityLogEventRegionalExitEvent_FieldTerminalPath: *fp, values: values.([]*timestamppb.Timestamp)} 6002 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 6003 return &ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues{ActivityLogEventRegionalExitEvent_FieldTerminalPath: *fp, values: values.([]string)} 6004 default: 6005 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fp.selector)) 6006 } 6007 return fpaov 6008 } 6009 6010 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 6011 return fp.WithIArrayOfValues(values) 6012 } 6013 6014 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogEventRegionalExitEvent_FieldPathArrayItemValue { 6015 switch fp.selector { 6016 default: 6017 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fp.selector)) 6018 } 6019 } 6020 6021 func (fp *ActivityLogEventRegionalExitEvent_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 6022 return fp.WithIArrayItemValue(value) 6023 } 6024 6025 type ActivityLogEventRegionalExitEvent_FieldSubPath struct { 6026 selector ActivityLogEventRegionalExitEvent_FieldPathSelector 6027 subPath gotenobject.FieldPath 6028 } 6029 6030 var _ ActivityLogEventRegionalExitEvent_FieldPath = (*ActivityLogEventRegionalExitEvent_FieldSubPath)(nil) 6031 6032 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) Selector() ActivityLogEventRegionalExitEvent_FieldPathSelector { 6033 return fps.selector 6034 } 6035 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) AsStatusSubPath() (rpc.Status_FieldPath, bool) { 6036 res, ok := fps.subPath.(rpc.Status_FieldPath) 6037 return res, ok 6038 } 6039 6040 // String returns path representation in proto convention 6041 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) String() string { 6042 return fps.selector.String() + "." + fps.subPath.String() 6043 } 6044 6045 // JSONString returns path representation is JSON convention 6046 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) JSONString() string { 6047 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 6048 } 6049 6050 // Get returns all values pointed by selected field from source ActivityLog_Event_RegionalExitEvent 6051 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) Get(source *ActivityLog_Event_RegionalExitEvent) (values []interface{}) { 6052 switch fps.selector { 6053 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 6054 values = append(values, fps.subPath.GetRaw(source.GetStatus())...) 6055 default: 6056 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fps.selector)) 6057 } 6058 return 6059 } 6060 6061 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) GetRaw(source proto.Message) []interface{} { 6062 return fps.Get(source.(*ActivityLog_Event_RegionalExitEvent)) 6063 } 6064 6065 // GetSingle returns value of selected field from source ActivityLog_Event_RegionalExitEvent 6066 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) GetSingle(source *ActivityLog_Event_RegionalExitEvent) (interface{}, bool) { 6067 switch fps.selector { 6068 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 6069 if source.GetStatus() == nil { 6070 return nil, false 6071 } 6072 return fps.subPath.GetSingleRaw(source.GetStatus()) 6073 default: 6074 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fps.selector)) 6075 } 6076 } 6077 6078 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 6079 return fps.GetSingle(source.(*ActivityLog_Event_RegionalExitEvent)) 6080 } 6081 6082 // GetDefault returns a default value of the field type 6083 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) GetDefault() interface{} { 6084 return fps.subPath.GetDefault() 6085 } 6086 6087 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) ClearValue(item *ActivityLog_Event_RegionalExitEvent) { 6088 if item != nil { 6089 switch fps.selector { 6090 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 6091 fps.subPath.ClearValueRaw(item.Status) 6092 default: 6093 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fps.selector)) 6094 } 6095 } 6096 } 6097 6098 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) ClearValueRaw(item proto.Message) { 6099 fps.ClearValue(item.(*ActivityLog_Event_RegionalExitEvent)) 6100 } 6101 6102 // IsLeaf - whether field path is holds simple value 6103 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) IsLeaf() bool { 6104 return fps.subPath.IsLeaf() 6105 } 6106 6107 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 6108 iPaths := []gotenobject.FieldPath{&ActivityLogEventRegionalExitEvent_FieldTerminalPath{selector: fps.selector}} 6109 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 6110 return iPaths 6111 } 6112 6113 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) WithIValue(value interface{}) ActivityLogEventRegionalExitEvent_FieldPathValue { 6114 return &ActivityLogEventRegionalExitEvent_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 6115 } 6116 6117 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 6118 return fps.WithIValue(value) 6119 } 6120 6121 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) WithIArrayOfValues(values interface{}) ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues { 6122 return &ActivityLogEventRegionalExitEvent_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 6123 } 6124 6125 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 6126 return fps.WithIArrayOfValues(values) 6127 } 6128 6129 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) WithIArrayItemValue(value interface{}) ActivityLogEventRegionalExitEvent_FieldPathArrayItemValue { 6130 return &ActivityLogEventRegionalExitEvent_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 6131 } 6132 6133 func (fps *ActivityLogEventRegionalExitEvent_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 6134 return fps.WithIArrayItemValue(value) 6135 } 6136 6137 // ActivityLogEventRegionalExitEvent_FieldPathValue allows storing values for RegionalExitEvent fields according to their type 6138 type ActivityLogEventRegionalExitEvent_FieldPathValue interface { 6139 ActivityLogEventRegionalExitEvent_FieldPath 6140 gotenobject.FieldPathValue 6141 SetTo(target **ActivityLog_Event_RegionalExitEvent) 6142 CompareWith(*ActivityLog_Event_RegionalExitEvent) (cmp int, comparable bool) 6143 } 6144 6145 func ParseActivityLogEventRegionalExitEvent_FieldPathValue(pathStr, valueStr string) (ActivityLogEventRegionalExitEvent_FieldPathValue, error) { 6146 fp, err := ParseActivityLogEventRegionalExitEvent_FieldPath(pathStr) 6147 if err != nil { 6148 return nil, err 6149 } 6150 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 6151 if err != nil { 6152 return nil, status.Errorf(codes.InvalidArgument, "error parsing RegionalExitEvent field path value from %s: %v", valueStr, err) 6153 } 6154 return fpv.(ActivityLogEventRegionalExitEvent_FieldPathValue), nil 6155 } 6156 6157 func MustParseActivityLogEventRegionalExitEvent_FieldPathValue(pathStr, valueStr string) ActivityLogEventRegionalExitEvent_FieldPathValue { 6158 fpv, err := ParseActivityLogEventRegionalExitEvent_FieldPathValue(pathStr, valueStr) 6159 if err != nil { 6160 panic(err) 6161 } 6162 return fpv 6163 } 6164 6165 type ActivityLogEventRegionalExitEvent_FieldTerminalPathValue struct { 6166 ActivityLogEventRegionalExitEvent_FieldTerminalPath 6167 value interface{} 6168 } 6169 6170 var _ ActivityLogEventRegionalExitEvent_FieldPathValue = (*ActivityLogEventRegionalExitEvent_FieldTerminalPathValue)(nil) 6171 6172 // GetRawValue returns raw value stored under selected path for 'RegionalExitEvent' as interface{} 6173 func (fpv *ActivityLogEventRegionalExitEvent_FieldTerminalPathValue) GetRawValue() interface{} { 6174 return fpv.value 6175 } 6176 func (fpv *ActivityLogEventRegionalExitEvent_FieldTerminalPathValue) AsStatusValue() (*rpc.Status, bool) { 6177 res, ok := fpv.value.(*rpc.Status) 6178 return res, ok 6179 } 6180 func (fpv *ActivityLogEventRegionalExitEvent_FieldTerminalPathValue) AsTimeValue() (*timestamppb.Timestamp, bool) { 6181 res, ok := fpv.value.(*timestamppb.Timestamp) 6182 return res, ok 6183 } 6184 func (fpv *ActivityLogEventRegionalExitEvent_FieldTerminalPathValue) AsRegionIdValue() (string, bool) { 6185 res, ok := fpv.value.(string) 6186 return res, ok 6187 } 6188 6189 // SetTo stores value for selected field for object RegionalExitEvent 6190 func (fpv *ActivityLogEventRegionalExitEvent_FieldTerminalPathValue) SetTo(target **ActivityLog_Event_RegionalExitEvent) { 6191 if *target == nil { 6192 *target = new(ActivityLog_Event_RegionalExitEvent) 6193 } 6194 switch fpv.selector { 6195 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 6196 (*target).Status = fpv.value.(*rpc.Status) 6197 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 6198 (*target).Time = fpv.value.(*timestamppb.Timestamp) 6199 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 6200 (*target).RegionId = fpv.value.(string) 6201 default: 6202 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fpv.selector)) 6203 } 6204 } 6205 6206 func (fpv *ActivityLogEventRegionalExitEvent_FieldTerminalPathValue) SetToRaw(target proto.Message) { 6207 typedObject := target.(*ActivityLog_Event_RegionalExitEvent) 6208 fpv.SetTo(&typedObject) 6209 } 6210 6211 // CompareWith compares value in the 'ActivityLogEventRegionalExitEvent_FieldTerminalPathValue' with the value under path in 'ActivityLog_Event_RegionalExitEvent'. 6212 func (fpv *ActivityLogEventRegionalExitEvent_FieldTerminalPathValue) CompareWith(source *ActivityLog_Event_RegionalExitEvent) (int, bool) { 6213 switch fpv.selector { 6214 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 6215 return 0, false 6216 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 6217 leftValue := fpv.value.(*timestamppb.Timestamp) 6218 rightValue := source.GetTime() 6219 if leftValue == nil { 6220 if rightValue != nil { 6221 return -1, true 6222 } 6223 return 0, true 6224 } 6225 if rightValue == nil { 6226 return 1, true 6227 } 6228 if leftValue.AsTime().Equal(rightValue.AsTime()) { 6229 return 0, true 6230 } else if leftValue.AsTime().Before(rightValue.AsTime()) { 6231 return -1, true 6232 } else { 6233 return 1, true 6234 } 6235 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 6236 leftValue := fpv.value.(string) 6237 rightValue := source.GetRegionId() 6238 if (leftValue) == (rightValue) { 6239 return 0, true 6240 } else if (leftValue) < (rightValue) { 6241 return -1, true 6242 } else { 6243 return 1, true 6244 } 6245 default: 6246 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fpv.selector)) 6247 } 6248 } 6249 6250 func (fpv *ActivityLogEventRegionalExitEvent_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 6251 return fpv.CompareWith(source.(*ActivityLog_Event_RegionalExitEvent)) 6252 } 6253 6254 type ActivityLogEventRegionalExitEvent_FieldSubPathValue struct { 6255 ActivityLogEventRegionalExitEvent_FieldPath 6256 subPathValue gotenobject.FieldPathValue 6257 } 6258 6259 var _ ActivityLogEventRegionalExitEvent_FieldPathValue = (*ActivityLogEventRegionalExitEvent_FieldSubPathValue)(nil) 6260 6261 func (fpvs *ActivityLogEventRegionalExitEvent_FieldSubPathValue) AsStatusPathValue() (rpc.Status_FieldPathValue, bool) { 6262 res, ok := fpvs.subPathValue.(rpc.Status_FieldPathValue) 6263 return res, ok 6264 } 6265 6266 func (fpvs *ActivityLogEventRegionalExitEvent_FieldSubPathValue) SetTo(target **ActivityLog_Event_RegionalExitEvent) { 6267 if *target == nil { 6268 *target = new(ActivityLog_Event_RegionalExitEvent) 6269 } 6270 switch fpvs.Selector() { 6271 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 6272 fpvs.subPathValue.(rpc.Status_FieldPathValue).SetTo(&(*target).Status) 6273 default: 6274 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fpvs.Selector())) 6275 } 6276 } 6277 6278 func (fpvs *ActivityLogEventRegionalExitEvent_FieldSubPathValue) SetToRaw(target proto.Message) { 6279 typedObject := target.(*ActivityLog_Event_RegionalExitEvent) 6280 fpvs.SetTo(&typedObject) 6281 } 6282 6283 func (fpvs *ActivityLogEventRegionalExitEvent_FieldSubPathValue) GetRawValue() interface{} { 6284 return fpvs.subPathValue.GetRawValue() 6285 } 6286 6287 func (fpvs *ActivityLogEventRegionalExitEvent_FieldSubPathValue) CompareWith(source *ActivityLog_Event_RegionalExitEvent) (int, bool) { 6288 switch fpvs.Selector() { 6289 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 6290 return fpvs.subPathValue.(rpc.Status_FieldPathValue).CompareWith(source.GetStatus()) 6291 default: 6292 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fpvs.Selector())) 6293 } 6294 } 6295 6296 func (fpvs *ActivityLogEventRegionalExitEvent_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 6297 return fpvs.CompareWith(source.(*ActivityLog_Event_RegionalExitEvent)) 6298 } 6299 6300 // ActivityLogEventRegionalExitEvent_FieldPathArrayItemValue allows storing single item in Path-specific values for RegionalExitEvent according to their type 6301 // Present only for array (repeated) types. 6302 type ActivityLogEventRegionalExitEvent_FieldPathArrayItemValue interface { 6303 gotenobject.FieldPathArrayItemValue 6304 ActivityLogEventRegionalExitEvent_FieldPath 6305 ContainsValue(*ActivityLog_Event_RegionalExitEvent) bool 6306 } 6307 6308 // ParseActivityLogEventRegionalExitEvent_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 6309 func ParseActivityLogEventRegionalExitEvent_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogEventRegionalExitEvent_FieldPathArrayItemValue, error) { 6310 fp, err := ParseActivityLogEventRegionalExitEvent_FieldPath(pathStr) 6311 if err != nil { 6312 return nil, err 6313 } 6314 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 6315 if err != nil { 6316 return nil, status.Errorf(codes.InvalidArgument, "error parsing RegionalExitEvent field path array item value from %s: %v", valueStr, err) 6317 } 6318 return fpaiv.(ActivityLogEventRegionalExitEvent_FieldPathArrayItemValue), nil 6319 } 6320 6321 func MustParseActivityLogEventRegionalExitEvent_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogEventRegionalExitEvent_FieldPathArrayItemValue { 6322 fpaiv, err := ParseActivityLogEventRegionalExitEvent_FieldPathArrayItemValue(pathStr, valueStr) 6323 if err != nil { 6324 panic(err) 6325 } 6326 return fpaiv 6327 } 6328 6329 type ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayItemValue struct { 6330 ActivityLogEventRegionalExitEvent_FieldTerminalPath 6331 value interface{} 6332 } 6333 6334 var _ ActivityLogEventRegionalExitEvent_FieldPathArrayItemValue = (*ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayItemValue)(nil) 6335 6336 // GetRawValue returns stored element value for array in object ActivityLog_Event_RegionalExitEvent as interface{} 6337 func (fpaiv *ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 6338 return fpaiv.value 6339 } 6340 6341 func (fpaiv *ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_Event_RegionalExitEvent) (interface{}, bool) { 6342 return nil, false 6343 } 6344 6345 func (fpaiv *ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 6346 return fpaiv.GetSingle(source.(*ActivityLog_Event_RegionalExitEvent)) 6347 } 6348 6349 // Contains returns a boolean indicating if value that is being held is present in given 'RegionalExitEvent' 6350 func (fpaiv *ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_Event_RegionalExitEvent) bool { 6351 slice := fpaiv.ActivityLogEventRegionalExitEvent_FieldTerminalPath.Get(source) 6352 for _, v := range slice { 6353 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 6354 if proto.Equal(asProtoMsg, v.(proto.Message)) { 6355 return true 6356 } 6357 } else if reflect.DeepEqual(v, fpaiv.value) { 6358 return true 6359 } 6360 } 6361 return false 6362 } 6363 6364 type ActivityLogEventRegionalExitEvent_FieldSubPathArrayItemValue struct { 6365 ActivityLogEventRegionalExitEvent_FieldPath 6366 subPathItemValue gotenobject.FieldPathArrayItemValue 6367 } 6368 6369 // GetRawValue returns stored array item value 6370 func (fpaivs *ActivityLogEventRegionalExitEvent_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 6371 return fpaivs.subPathItemValue.GetRawItemValue() 6372 } 6373 func (fpaivs *ActivityLogEventRegionalExitEvent_FieldSubPathArrayItemValue) AsStatusPathItemValue() (rpc.Status_FieldPathArrayItemValue, bool) { 6374 res, ok := fpaivs.subPathItemValue.(rpc.Status_FieldPathArrayItemValue) 6375 return res, ok 6376 } 6377 6378 // Contains returns a boolean indicating if value that is being held is present in given 'RegionalExitEvent' 6379 func (fpaivs *ActivityLogEventRegionalExitEvent_FieldSubPathArrayItemValue) ContainsValue(source *ActivityLog_Event_RegionalExitEvent) bool { 6380 switch fpaivs.Selector() { 6381 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 6382 return fpaivs.subPathItemValue.(rpc.Status_FieldPathArrayItemValue).ContainsValue(source.GetStatus()) 6383 default: 6384 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_RegionalExitEvent: %d", fpaivs.Selector())) 6385 } 6386 } 6387 6388 // ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues allows storing slice of values for RegionalExitEvent fields according to their type 6389 type ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues interface { 6390 gotenobject.FieldPathArrayOfValues 6391 ActivityLogEventRegionalExitEvent_FieldPath 6392 } 6393 6394 func ParseActivityLogEventRegionalExitEvent_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues, error) { 6395 fp, err := ParseActivityLogEventRegionalExitEvent_FieldPath(pathStr) 6396 if err != nil { 6397 return nil, err 6398 } 6399 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 6400 if err != nil { 6401 return nil, status.Errorf(codes.InvalidArgument, "error parsing RegionalExitEvent field path array of values from %s: %v", valuesStr, err) 6402 } 6403 return fpaov.(ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues), nil 6404 } 6405 6406 func MustParseActivityLogEventRegionalExitEvent_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues { 6407 fpaov, err := ParseActivityLogEventRegionalExitEvent_FieldPathArrayOfValues(pathStr, valuesStr) 6408 if err != nil { 6409 panic(err) 6410 } 6411 return fpaov 6412 } 6413 6414 type ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues struct { 6415 ActivityLogEventRegionalExitEvent_FieldTerminalPath 6416 values interface{} 6417 } 6418 6419 var _ ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues = (*ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues)(nil) 6420 6421 func (fpaov *ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 6422 switch fpaov.selector { 6423 case ActivityLogEventRegionalExitEvent_FieldPathSelectorStatus: 6424 for _, v := range fpaov.values.([]*rpc.Status) { 6425 values = append(values, v) 6426 } 6427 case ActivityLogEventRegionalExitEvent_FieldPathSelectorTime: 6428 for _, v := range fpaov.values.([]*timestamppb.Timestamp) { 6429 values = append(values, v) 6430 } 6431 case ActivityLogEventRegionalExitEvent_FieldPathSelectorRegionId: 6432 for _, v := range fpaov.values.([]string) { 6433 values = append(values, v) 6434 } 6435 } 6436 return 6437 } 6438 func (fpaov *ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues) AsStatusArrayOfValues() ([]*rpc.Status, bool) { 6439 res, ok := fpaov.values.([]*rpc.Status) 6440 return res, ok 6441 } 6442 func (fpaov *ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues) AsTimeArrayOfValues() ([]*timestamppb.Timestamp, bool) { 6443 res, ok := fpaov.values.([]*timestamppb.Timestamp) 6444 return res, ok 6445 } 6446 func (fpaov *ActivityLogEventRegionalExitEvent_FieldTerminalPathArrayOfValues) AsRegionIdArrayOfValues() ([]string, bool) { 6447 res, ok := fpaov.values.([]string) 6448 return res, ok 6449 } 6450 6451 type ActivityLogEventRegionalExitEvent_FieldSubPathArrayOfValues struct { 6452 ActivityLogEventRegionalExitEvent_FieldPath 6453 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 6454 } 6455 6456 var _ ActivityLogEventRegionalExitEvent_FieldPathArrayOfValues = (*ActivityLogEventRegionalExitEvent_FieldSubPathArrayOfValues)(nil) 6457 6458 func (fpsaov *ActivityLogEventRegionalExitEvent_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 6459 return fpsaov.subPathArrayOfValues.GetRawValues() 6460 } 6461 func (fpsaov *ActivityLogEventRegionalExitEvent_FieldSubPathArrayOfValues) AsStatusPathArrayOfValues() (rpc.Status_FieldPathArrayOfValues, bool) { 6462 res, ok := fpsaov.subPathArrayOfValues.(rpc.Status_FieldPathArrayOfValues) 6463 return res, ok 6464 } 6465 6466 // FieldPath provides implementation to handle 6467 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 6468 type ActivityLogEventExitEvent_FieldPath interface { 6469 gotenobject.FieldPath 6470 Selector() ActivityLogEventExitEvent_FieldPathSelector 6471 Get(source *ActivityLog_Event_ExitEvent) []interface{} 6472 GetSingle(source *ActivityLog_Event_ExitEvent) (interface{}, bool) 6473 ClearValue(item *ActivityLog_Event_ExitEvent) 6474 6475 // Those methods build corresponding ActivityLogEventExitEvent_FieldPathValue 6476 // (or array of values) and holds passed value. Panics if injected type is incorrect. 6477 WithIValue(value interface{}) ActivityLogEventExitEvent_FieldPathValue 6478 WithIArrayOfValues(values interface{}) ActivityLogEventExitEvent_FieldPathArrayOfValues 6479 WithIArrayItemValue(value interface{}) ActivityLogEventExitEvent_FieldPathArrayItemValue 6480 } 6481 6482 type ActivityLogEventExitEvent_FieldPathSelector int32 6483 6484 const ( 6485 ActivityLogEventExitEvent_FieldPathSelectorStatus ActivityLogEventExitEvent_FieldPathSelector = 0 6486 ActivityLogEventExitEvent_FieldPathSelectorTime ActivityLogEventExitEvent_FieldPathSelector = 1 6487 ) 6488 6489 func (s ActivityLogEventExitEvent_FieldPathSelector) String() string { 6490 switch s { 6491 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6492 return "status" 6493 case ActivityLogEventExitEvent_FieldPathSelectorTime: 6494 return "time" 6495 default: 6496 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", s)) 6497 } 6498 } 6499 6500 func BuildActivityLogEventExitEvent_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogEventExitEvent_FieldPath, error) { 6501 if len(fp) == 0 { 6502 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_Event_ExitEvent") 6503 } 6504 if len(fp) == 1 { 6505 switch fp[0] { 6506 case "status": 6507 return &ActivityLogEventExitEvent_FieldTerminalPath{selector: ActivityLogEventExitEvent_FieldPathSelectorStatus}, nil 6508 case "time": 6509 return &ActivityLogEventExitEvent_FieldTerminalPath{selector: ActivityLogEventExitEvent_FieldPathSelectorTime}, nil 6510 } 6511 } else { 6512 switch fp[0] { 6513 case "status": 6514 if subpath, err := rpc.BuildStatus_FieldPath(fp[1:]); err != nil { 6515 return nil, err 6516 } else { 6517 return &ActivityLogEventExitEvent_FieldSubPath{selector: ActivityLogEventExitEvent_FieldPathSelectorStatus, subPath: subpath}, nil 6518 } 6519 } 6520 } 6521 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_Event_ExitEvent", fp) 6522 } 6523 6524 func ParseActivityLogEventExitEvent_FieldPath(rawField string) (ActivityLogEventExitEvent_FieldPath, error) { 6525 fp, err := gotenobject.ParseRawFieldPath(rawField) 6526 if err != nil { 6527 return nil, err 6528 } 6529 return BuildActivityLogEventExitEvent_FieldPath(fp) 6530 } 6531 6532 func MustParseActivityLogEventExitEvent_FieldPath(rawField string) ActivityLogEventExitEvent_FieldPath { 6533 fp, err := ParseActivityLogEventExitEvent_FieldPath(rawField) 6534 if err != nil { 6535 panic(err) 6536 } 6537 return fp 6538 } 6539 6540 type ActivityLogEventExitEvent_FieldTerminalPath struct { 6541 selector ActivityLogEventExitEvent_FieldPathSelector 6542 } 6543 6544 var _ ActivityLogEventExitEvent_FieldPath = (*ActivityLogEventExitEvent_FieldTerminalPath)(nil) 6545 6546 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) Selector() ActivityLogEventExitEvent_FieldPathSelector { 6547 return fp.selector 6548 } 6549 6550 // String returns path representation in proto convention 6551 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) String() string { 6552 return fp.selector.String() 6553 } 6554 6555 // JSONString returns path representation is JSON convention 6556 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) JSONString() string { 6557 return strcase.ToLowerCamel(fp.String()) 6558 } 6559 6560 // Get returns all values pointed by specific field from source ActivityLog_Event_ExitEvent 6561 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) Get(source *ActivityLog_Event_ExitEvent) (values []interface{}) { 6562 if source != nil { 6563 switch fp.selector { 6564 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6565 if source.Status != nil { 6566 values = append(values, source.Status) 6567 } 6568 case ActivityLogEventExitEvent_FieldPathSelectorTime: 6569 if source.Time != nil { 6570 values = append(values, source.Time) 6571 } 6572 default: 6573 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fp.selector)) 6574 } 6575 } 6576 return 6577 } 6578 6579 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 6580 return fp.Get(source.(*ActivityLog_Event_ExitEvent)) 6581 } 6582 6583 // GetSingle returns value pointed by specific field of from source ActivityLog_Event_ExitEvent 6584 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) GetSingle(source *ActivityLog_Event_ExitEvent) (interface{}, bool) { 6585 switch fp.selector { 6586 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6587 res := source.GetStatus() 6588 return res, res != nil 6589 case ActivityLogEventExitEvent_FieldPathSelectorTime: 6590 res := source.GetTime() 6591 return res, res != nil 6592 default: 6593 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fp.selector)) 6594 } 6595 } 6596 6597 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 6598 return fp.GetSingle(source.(*ActivityLog_Event_ExitEvent)) 6599 } 6600 6601 // GetDefault returns a default value of the field type 6602 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) GetDefault() interface{} { 6603 switch fp.selector { 6604 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6605 return (*rpc.Status)(nil) 6606 case ActivityLogEventExitEvent_FieldPathSelectorTime: 6607 return (*timestamppb.Timestamp)(nil) 6608 default: 6609 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fp.selector)) 6610 } 6611 } 6612 6613 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) ClearValue(item *ActivityLog_Event_ExitEvent) { 6614 if item != nil { 6615 switch fp.selector { 6616 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6617 item.Status = nil 6618 case ActivityLogEventExitEvent_FieldPathSelectorTime: 6619 item.Time = nil 6620 default: 6621 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fp.selector)) 6622 } 6623 } 6624 } 6625 6626 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) ClearValueRaw(item proto.Message) { 6627 fp.ClearValue(item.(*ActivityLog_Event_ExitEvent)) 6628 } 6629 6630 // IsLeaf - whether field path is holds simple value 6631 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) IsLeaf() bool { 6632 return fp.selector == ActivityLogEventExitEvent_FieldPathSelectorTime 6633 } 6634 6635 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 6636 return []gotenobject.FieldPath{fp} 6637 } 6638 6639 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) WithIValue(value interface{}) ActivityLogEventExitEvent_FieldPathValue { 6640 switch fp.selector { 6641 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6642 return &ActivityLogEventExitEvent_FieldTerminalPathValue{ActivityLogEventExitEvent_FieldTerminalPath: *fp, value: value.(*rpc.Status)} 6643 case ActivityLogEventExitEvent_FieldPathSelectorTime: 6644 return &ActivityLogEventExitEvent_FieldTerminalPathValue{ActivityLogEventExitEvent_FieldTerminalPath: *fp, value: value.(*timestamppb.Timestamp)} 6645 default: 6646 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fp.selector)) 6647 } 6648 } 6649 6650 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 6651 return fp.WithIValue(value) 6652 } 6653 6654 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogEventExitEvent_FieldPathArrayOfValues { 6655 fpaov := &ActivityLogEventExitEvent_FieldTerminalPathArrayOfValues{ActivityLogEventExitEvent_FieldTerminalPath: *fp} 6656 switch fp.selector { 6657 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6658 return &ActivityLogEventExitEvent_FieldTerminalPathArrayOfValues{ActivityLogEventExitEvent_FieldTerminalPath: *fp, values: values.([]*rpc.Status)} 6659 case ActivityLogEventExitEvent_FieldPathSelectorTime: 6660 return &ActivityLogEventExitEvent_FieldTerminalPathArrayOfValues{ActivityLogEventExitEvent_FieldTerminalPath: *fp, values: values.([]*timestamppb.Timestamp)} 6661 default: 6662 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fp.selector)) 6663 } 6664 return fpaov 6665 } 6666 6667 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 6668 return fp.WithIArrayOfValues(values) 6669 } 6670 6671 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogEventExitEvent_FieldPathArrayItemValue { 6672 switch fp.selector { 6673 default: 6674 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fp.selector)) 6675 } 6676 } 6677 6678 func (fp *ActivityLogEventExitEvent_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 6679 return fp.WithIArrayItemValue(value) 6680 } 6681 6682 type ActivityLogEventExitEvent_FieldSubPath struct { 6683 selector ActivityLogEventExitEvent_FieldPathSelector 6684 subPath gotenobject.FieldPath 6685 } 6686 6687 var _ ActivityLogEventExitEvent_FieldPath = (*ActivityLogEventExitEvent_FieldSubPath)(nil) 6688 6689 func (fps *ActivityLogEventExitEvent_FieldSubPath) Selector() ActivityLogEventExitEvent_FieldPathSelector { 6690 return fps.selector 6691 } 6692 func (fps *ActivityLogEventExitEvent_FieldSubPath) AsStatusSubPath() (rpc.Status_FieldPath, bool) { 6693 res, ok := fps.subPath.(rpc.Status_FieldPath) 6694 return res, ok 6695 } 6696 6697 // String returns path representation in proto convention 6698 func (fps *ActivityLogEventExitEvent_FieldSubPath) String() string { 6699 return fps.selector.String() + "." + fps.subPath.String() 6700 } 6701 6702 // JSONString returns path representation is JSON convention 6703 func (fps *ActivityLogEventExitEvent_FieldSubPath) JSONString() string { 6704 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 6705 } 6706 6707 // Get returns all values pointed by selected field from source ActivityLog_Event_ExitEvent 6708 func (fps *ActivityLogEventExitEvent_FieldSubPath) Get(source *ActivityLog_Event_ExitEvent) (values []interface{}) { 6709 switch fps.selector { 6710 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6711 values = append(values, fps.subPath.GetRaw(source.GetStatus())...) 6712 default: 6713 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fps.selector)) 6714 } 6715 return 6716 } 6717 6718 func (fps *ActivityLogEventExitEvent_FieldSubPath) GetRaw(source proto.Message) []interface{} { 6719 return fps.Get(source.(*ActivityLog_Event_ExitEvent)) 6720 } 6721 6722 // GetSingle returns value of selected field from source ActivityLog_Event_ExitEvent 6723 func (fps *ActivityLogEventExitEvent_FieldSubPath) GetSingle(source *ActivityLog_Event_ExitEvent) (interface{}, bool) { 6724 switch fps.selector { 6725 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6726 if source.GetStatus() == nil { 6727 return nil, false 6728 } 6729 return fps.subPath.GetSingleRaw(source.GetStatus()) 6730 default: 6731 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fps.selector)) 6732 } 6733 } 6734 6735 func (fps *ActivityLogEventExitEvent_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 6736 return fps.GetSingle(source.(*ActivityLog_Event_ExitEvent)) 6737 } 6738 6739 // GetDefault returns a default value of the field type 6740 func (fps *ActivityLogEventExitEvent_FieldSubPath) GetDefault() interface{} { 6741 return fps.subPath.GetDefault() 6742 } 6743 6744 func (fps *ActivityLogEventExitEvent_FieldSubPath) ClearValue(item *ActivityLog_Event_ExitEvent) { 6745 if item != nil { 6746 switch fps.selector { 6747 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6748 fps.subPath.ClearValueRaw(item.Status) 6749 default: 6750 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fps.selector)) 6751 } 6752 } 6753 } 6754 6755 func (fps *ActivityLogEventExitEvent_FieldSubPath) ClearValueRaw(item proto.Message) { 6756 fps.ClearValue(item.(*ActivityLog_Event_ExitEvent)) 6757 } 6758 6759 // IsLeaf - whether field path is holds simple value 6760 func (fps *ActivityLogEventExitEvent_FieldSubPath) IsLeaf() bool { 6761 return fps.subPath.IsLeaf() 6762 } 6763 6764 func (fps *ActivityLogEventExitEvent_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 6765 iPaths := []gotenobject.FieldPath{&ActivityLogEventExitEvent_FieldTerminalPath{selector: fps.selector}} 6766 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 6767 return iPaths 6768 } 6769 6770 func (fps *ActivityLogEventExitEvent_FieldSubPath) WithIValue(value interface{}) ActivityLogEventExitEvent_FieldPathValue { 6771 return &ActivityLogEventExitEvent_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 6772 } 6773 6774 func (fps *ActivityLogEventExitEvent_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 6775 return fps.WithIValue(value) 6776 } 6777 6778 func (fps *ActivityLogEventExitEvent_FieldSubPath) WithIArrayOfValues(values interface{}) ActivityLogEventExitEvent_FieldPathArrayOfValues { 6779 return &ActivityLogEventExitEvent_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 6780 } 6781 6782 func (fps *ActivityLogEventExitEvent_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 6783 return fps.WithIArrayOfValues(values) 6784 } 6785 6786 func (fps *ActivityLogEventExitEvent_FieldSubPath) WithIArrayItemValue(value interface{}) ActivityLogEventExitEvent_FieldPathArrayItemValue { 6787 return &ActivityLogEventExitEvent_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 6788 } 6789 6790 func (fps *ActivityLogEventExitEvent_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 6791 return fps.WithIArrayItemValue(value) 6792 } 6793 6794 // ActivityLogEventExitEvent_FieldPathValue allows storing values for ExitEvent fields according to their type 6795 type ActivityLogEventExitEvent_FieldPathValue interface { 6796 ActivityLogEventExitEvent_FieldPath 6797 gotenobject.FieldPathValue 6798 SetTo(target **ActivityLog_Event_ExitEvent) 6799 CompareWith(*ActivityLog_Event_ExitEvent) (cmp int, comparable bool) 6800 } 6801 6802 func ParseActivityLogEventExitEvent_FieldPathValue(pathStr, valueStr string) (ActivityLogEventExitEvent_FieldPathValue, error) { 6803 fp, err := ParseActivityLogEventExitEvent_FieldPath(pathStr) 6804 if err != nil { 6805 return nil, err 6806 } 6807 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 6808 if err != nil { 6809 return nil, status.Errorf(codes.InvalidArgument, "error parsing ExitEvent field path value from %s: %v", valueStr, err) 6810 } 6811 return fpv.(ActivityLogEventExitEvent_FieldPathValue), nil 6812 } 6813 6814 func MustParseActivityLogEventExitEvent_FieldPathValue(pathStr, valueStr string) ActivityLogEventExitEvent_FieldPathValue { 6815 fpv, err := ParseActivityLogEventExitEvent_FieldPathValue(pathStr, valueStr) 6816 if err != nil { 6817 panic(err) 6818 } 6819 return fpv 6820 } 6821 6822 type ActivityLogEventExitEvent_FieldTerminalPathValue struct { 6823 ActivityLogEventExitEvent_FieldTerminalPath 6824 value interface{} 6825 } 6826 6827 var _ ActivityLogEventExitEvent_FieldPathValue = (*ActivityLogEventExitEvent_FieldTerminalPathValue)(nil) 6828 6829 // GetRawValue returns raw value stored under selected path for 'ExitEvent' as interface{} 6830 func (fpv *ActivityLogEventExitEvent_FieldTerminalPathValue) GetRawValue() interface{} { 6831 return fpv.value 6832 } 6833 func (fpv *ActivityLogEventExitEvent_FieldTerminalPathValue) AsStatusValue() (*rpc.Status, bool) { 6834 res, ok := fpv.value.(*rpc.Status) 6835 return res, ok 6836 } 6837 func (fpv *ActivityLogEventExitEvent_FieldTerminalPathValue) AsTimeValue() (*timestamppb.Timestamp, bool) { 6838 res, ok := fpv.value.(*timestamppb.Timestamp) 6839 return res, ok 6840 } 6841 6842 // SetTo stores value for selected field for object ExitEvent 6843 func (fpv *ActivityLogEventExitEvent_FieldTerminalPathValue) SetTo(target **ActivityLog_Event_ExitEvent) { 6844 if *target == nil { 6845 *target = new(ActivityLog_Event_ExitEvent) 6846 } 6847 switch fpv.selector { 6848 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6849 (*target).Status = fpv.value.(*rpc.Status) 6850 case ActivityLogEventExitEvent_FieldPathSelectorTime: 6851 (*target).Time = fpv.value.(*timestamppb.Timestamp) 6852 default: 6853 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fpv.selector)) 6854 } 6855 } 6856 6857 func (fpv *ActivityLogEventExitEvent_FieldTerminalPathValue) SetToRaw(target proto.Message) { 6858 typedObject := target.(*ActivityLog_Event_ExitEvent) 6859 fpv.SetTo(&typedObject) 6860 } 6861 6862 // CompareWith compares value in the 'ActivityLogEventExitEvent_FieldTerminalPathValue' with the value under path in 'ActivityLog_Event_ExitEvent'. 6863 func (fpv *ActivityLogEventExitEvent_FieldTerminalPathValue) CompareWith(source *ActivityLog_Event_ExitEvent) (int, bool) { 6864 switch fpv.selector { 6865 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6866 return 0, false 6867 case ActivityLogEventExitEvent_FieldPathSelectorTime: 6868 leftValue := fpv.value.(*timestamppb.Timestamp) 6869 rightValue := source.GetTime() 6870 if leftValue == nil { 6871 if rightValue != nil { 6872 return -1, true 6873 } 6874 return 0, true 6875 } 6876 if rightValue == nil { 6877 return 1, true 6878 } 6879 if leftValue.AsTime().Equal(rightValue.AsTime()) { 6880 return 0, true 6881 } else if leftValue.AsTime().Before(rightValue.AsTime()) { 6882 return -1, true 6883 } else { 6884 return 1, true 6885 } 6886 default: 6887 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fpv.selector)) 6888 } 6889 } 6890 6891 func (fpv *ActivityLogEventExitEvent_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 6892 return fpv.CompareWith(source.(*ActivityLog_Event_ExitEvent)) 6893 } 6894 6895 type ActivityLogEventExitEvent_FieldSubPathValue struct { 6896 ActivityLogEventExitEvent_FieldPath 6897 subPathValue gotenobject.FieldPathValue 6898 } 6899 6900 var _ ActivityLogEventExitEvent_FieldPathValue = (*ActivityLogEventExitEvent_FieldSubPathValue)(nil) 6901 6902 func (fpvs *ActivityLogEventExitEvent_FieldSubPathValue) AsStatusPathValue() (rpc.Status_FieldPathValue, bool) { 6903 res, ok := fpvs.subPathValue.(rpc.Status_FieldPathValue) 6904 return res, ok 6905 } 6906 6907 func (fpvs *ActivityLogEventExitEvent_FieldSubPathValue) SetTo(target **ActivityLog_Event_ExitEvent) { 6908 if *target == nil { 6909 *target = new(ActivityLog_Event_ExitEvent) 6910 } 6911 switch fpvs.Selector() { 6912 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6913 fpvs.subPathValue.(rpc.Status_FieldPathValue).SetTo(&(*target).Status) 6914 default: 6915 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fpvs.Selector())) 6916 } 6917 } 6918 6919 func (fpvs *ActivityLogEventExitEvent_FieldSubPathValue) SetToRaw(target proto.Message) { 6920 typedObject := target.(*ActivityLog_Event_ExitEvent) 6921 fpvs.SetTo(&typedObject) 6922 } 6923 6924 func (fpvs *ActivityLogEventExitEvent_FieldSubPathValue) GetRawValue() interface{} { 6925 return fpvs.subPathValue.GetRawValue() 6926 } 6927 6928 func (fpvs *ActivityLogEventExitEvent_FieldSubPathValue) CompareWith(source *ActivityLog_Event_ExitEvent) (int, bool) { 6929 switch fpvs.Selector() { 6930 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 6931 return fpvs.subPathValue.(rpc.Status_FieldPathValue).CompareWith(source.GetStatus()) 6932 default: 6933 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fpvs.Selector())) 6934 } 6935 } 6936 6937 func (fpvs *ActivityLogEventExitEvent_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 6938 return fpvs.CompareWith(source.(*ActivityLog_Event_ExitEvent)) 6939 } 6940 6941 // ActivityLogEventExitEvent_FieldPathArrayItemValue allows storing single item in Path-specific values for ExitEvent according to their type 6942 // Present only for array (repeated) types. 6943 type ActivityLogEventExitEvent_FieldPathArrayItemValue interface { 6944 gotenobject.FieldPathArrayItemValue 6945 ActivityLogEventExitEvent_FieldPath 6946 ContainsValue(*ActivityLog_Event_ExitEvent) bool 6947 } 6948 6949 // ParseActivityLogEventExitEvent_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 6950 func ParseActivityLogEventExitEvent_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogEventExitEvent_FieldPathArrayItemValue, error) { 6951 fp, err := ParseActivityLogEventExitEvent_FieldPath(pathStr) 6952 if err != nil { 6953 return nil, err 6954 } 6955 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 6956 if err != nil { 6957 return nil, status.Errorf(codes.InvalidArgument, "error parsing ExitEvent field path array item value from %s: %v", valueStr, err) 6958 } 6959 return fpaiv.(ActivityLogEventExitEvent_FieldPathArrayItemValue), nil 6960 } 6961 6962 func MustParseActivityLogEventExitEvent_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogEventExitEvent_FieldPathArrayItemValue { 6963 fpaiv, err := ParseActivityLogEventExitEvent_FieldPathArrayItemValue(pathStr, valueStr) 6964 if err != nil { 6965 panic(err) 6966 } 6967 return fpaiv 6968 } 6969 6970 type ActivityLogEventExitEvent_FieldTerminalPathArrayItemValue struct { 6971 ActivityLogEventExitEvent_FieldTerminalPath 6972 value interface{} 6973 } 6974 6975 var _ ActivityLogEventExitEvent_FieldPathArrayItemValue = (*ActivityLogEventExitEvent_FieldTerminalPathArrayItemValue)(nil) 6976 6977 // GetRawValue returns stored element value for array in object ActivityLog_Event_ExitEvent as interface{} 6978 func (fpaiv *ActivityLogEventExitEvent_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 6979 return fpaiv.value 6980 } 6981 6982 func (fpaiv *ActivityLogEventExitEvent_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_Event_ExitEvent) (interface{}, bool) { 6983 return nil, false 6984 } 6985 6986 func (fpaiv *ActivityLogEventExitEvent_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 6987 return fpaiv.GetSingle(source.(*ActivityLog_Event_ExitEvent)) 6988 } 6989 6990 // Contains returns a boolean indicating if value that is being held is present in given 'ExitEvent' 6991 func (fpaiv *ActivityLogEventExitEvent_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_Event_ExitEvent) bool { 6992 slice := fpaiv.ActivityLogEventExitEvent_FieldTerminalPath.Get(source) 6993 for _, v := range slice { 6994 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 6995 if proto.Equal(asProtoMsg, v.(proto.Message)) { 6996 return true 6997 } 6998 } else if reflect.DeepEqual(v, fpaiv.value) { 6999 return true 7000 } 7001 } 7002 return false 7003 } 7004 7005 type ActivityLogEventExitEvent_FieldSubPathArrayItemValue struct { 7006 ActivityLogEventExitEvent_FieldPath 7007 subPathItemValue gotenobject.FieldPathArrayItemValue 7008 } 7009 7010 // GetRawValue returns stored array item value 7011 func (fpaivs *ActivityLogEventExitEvent_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 7012 return fpaivs.subPathItemValue.GetRawItemValue() 7013 } 7014 func (fpaivs *ActivityLogEventExitEvent_FieldSubPathArrayItemValue) AsStatusPathItemValue() (rpc.Status_FieldPathArrayItemValue, bool) { 7015 res, ok := fpaivs.subPathItemValue.(rpc.Status_FieldPathArrayItemValue) 7016 return res, ok 7017 } 7018 7019 // Contains returns a boolean indicating if value that is being held is present in given 'ExitEvent' 7020 func (fpaivs *ActivityLogEventExitEvent_FieldSubPathArrayItemValue) ContainsValue(source *ActivityLog_Event_ExitEvent) bool { 7021 switch fpaivs.Selector() { 7022 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 7023 return fpaivs.subPathItemValue.(rpc.Status_FieldPathArrayItemValue).ContainsValue(source.GetStatus()) 7024 default: 7025 panic(fmt.Sprintf("Invalid selector for ActivityLog_Event_ExitEvent: %d", fpaivs.Selector())) 7026 } 7027 } 7028 7029 // ActivityLogEventExitEvent_FieldPathArrayOfValues allows storing slice of values for ExitEvent fields according to their type 7030 type ActivityLogEventExitEvent_FieldPathArrayOfValues interface { 7031 gotenobject.FieldPathArrayOfValues 7032 ActivityLogEventExitEvent_FieldPath 7033 } 7034 7035 func ParseActivityLogEventExitEvent_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogEventExitEvent_FieldPathArrayOfValues, error) { 7036 fp, err := ParseActivityLogEventExitEvent_FieldPath(pathStr) 7037 if err != nil { 7038 return nil, err 7039 } 7040 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 7041 if err != nil { 7042 return nil, status.Errorf(codes.InvalidArgument, "error parsing ExitEvent field path array of values from %s: %v", valuesStr, err) 7043 } 7044 return fpaov.(ActivityLogEventExitEvent_FieldPathArrayOfValues), nil 7045 } 7046 7047 func MustParseActivityLogEventExitEvent_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogEventExitEvent_FieldPathArrayOfValues { 7048 fpaov, err := ParseActivityLogEventExitEvent_FieldPathArrayOfValues(pathStr, valuesStr) 7049 if err != nil { 7050 panic(err) 7051 } 7052 return fpaov 7053 } 7054 7055 type ActivityLogEventExitEvent_FieldTerminalPathArrayOfValues struct { 7056 ActivityLogEventExitEvent_FieldTerminalPath 7057 values interface{} 7058 } 7059 7060 var _ ActivityLogEventExitEvent_FieldPathArrayOfValues = (*ActivityLogEventExitEvent_FieldTerminalPathArrayOfValues)(nil) 7061 7062 func (fpaov *ActivityLogEventExitEvent_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 7063 switch fpaov.selector { 7064 case ActivityLogEventExitEvent_FieldPathSelectorStatus: 7065 for _, v := range fpaov.values.([]*rpc.Status) { 7066 values = append(values, v) 7067 } 7068 case ActivityLogEventExitEvent_FieldPathSelectorTime: 7069 for _, v := range fpaov.values.([]*timestamppb.Timestamp) { 7070 values = append(values, v) 7071 } 7072 } 7073 return 7074 } 7075 func (fpaov *ActivityLogEventExitEvent_FieldTerminalPathArrayOfValues) AsStatusArrayOfValues() ([]*rpc.Status, bool) { 7076 res, ok := fpaov.values.([]*rpc.Status) 7077 return res, ok 7078 } 7079 func (fpaov *ActivityLogEventExitEvent_FieldTerminalPathArrayOfValues) AsTimeArrayOfValues() ([]*timestamppb.Timestamp, bool) { 7080 res, ok := fpaov.values.([]*timestamppb.Timestamp) 7081 return res, ok 7082 } 7083 7084 type ActivityLogEventExitEvent_FieldSubPathArrayOfValues struct { 7085 ActivityLogEventExitEvent_FieldPath 7086 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 7087 } 7088 7089 var _ ActivityLogEventExitEvent_FieldPathArrayOfValues = (*ActivityLogEventExitEvent_FieldSubPathArrayOfValues)(nil) 7090 7091 func (fpsaov *ActivityLogEventExitEvent_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 7092 return fpsaov.subPathArrayOfValues.GetRawValues() 7093 } 7094 func (fpsaov *ActivityLogEventExitEvent_FieldSubPathArrayOfValues) AsStatusPathArrayOfValues() (rpc.Status_FieldPathArrayOfValues, bool) { 7095 res, ok := fpsaov.subPathArrayOfValues.(rpc.Status_FieldPathArrayOfValues) 7096 return res, ok 7097 } 7098 7099 // FieldPath provides implementation to handle 7100 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 7101 type ActivityLogResourceDifference_FieldPath interface { 7102 gotenobject.FieldPath 7103 Selector() ActivityLogResourceDifference_FieldPathSelector 7104 Get(source *ActivityLog_Resource_Difference) []interface{} 7105 GetSingle(source *ActivityLog_Resource_Difference) (interface{}, bool) 7106 ClearValue(item *ActivityLog_Resource_Difference) 7107 7108 // Those methods build corresponding ActivityLogResourceDifference_FieldPathValue 7109 // (or array of values) and holds passed value. Panics if injected type is incorrect. 7110 WithIValue(value interface{}) ActivityLogResourceDifference_FieldPathValue 7111 WithIArrayOfValues(values interface{}) ActivityLogResourceDifference_FieldPathArrayOfValues 7112 WithIArrayItemValue(value interface{}) ActivityLogResourceDifference_FieldPathArrayItemValue 7113 } 7114 7115 type ActivityLogResourceDifference_FieldPathSelector int32 7116 7117 const ( 7118 ActivityLogResourceDifference_FieldPathSelectorFields ActivityLogResourceDifference_FieldPathSelector = 0 7119 ActivityLogResourceDifference_FieldPathSelectorBefore ActivityLogResourceDifference_FieldPathSelector = 1 7120 ActivityLogResourceDifference_FieldPathSelectorAfter ActivityLogResourceDifference_FieldPathSelector = 2 7121 ) 7122 7123 func (s ActivityLogResourceDifference_FieldPathSelector) String() string { 7124 switch s { 7125 case ActivityLogResourceDifference_FieldPathSelectorFields: 7126 return "fields" 7127 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7128 return "before" 7129 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7130 return "after" 7131 default: 7132 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", s)) 7133 } 7134 } 7135 7136 func BuildActivityLogResourceDifference_FieldPath(fp gotenobject.RawFieldPath) (ActivityLogResourceDifference_FieldPath, error) { 7137 if len(fp) == 0 { 7138 return nil, status.Error(codes.InvalidArgument, "empty field path for object ActivityLog_Resource_Difference") 7139 } 7140 if len(fp) == 1 { 7141 switch fp[0] { 7142 case "fields": 7143 return &ActivityLogResourceDifference_FieldTerminalPath{selector: ActivityLogResourceDifference_FieldPathSelectorFields}, nil 7144 case "before": 7145 return &ActivityLogResourceDifference_FieldTerminalPath{selector: ActivityLogResourceDifference_FieldPathSelectorBefore}, nil 7146 case "after": 7147 return &ActivityLogResourceDifference_FieldTerminalPath{selector: ActivityLogResourceDifference_FieldPathSelectorAfter}, nil 7148 } 7149 } 7150 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object ActivityLog_Resource_Difference", fp) 7151 } 7152 7153 func ParseActivityLogResourceDifference_FieldPath(rawField string) (ActivityLogResourceDifference_FieldPath, error) { 7154 fp, err := gotenobject.ParseRawFieldPath(rawField) 7155 if err != nil { 7156 return nil, err 7157 } 7158 return BuildActivityLogResourceDifference_FieldPath(fp) 7159 } 7160 7161 func MustParseActivityLogResourceDifference_FieldPath(rawField string) ActivityLogResourceDifference_FieldPath { 7162 fp, err := ParseActivityLogResourceDifference_FieldPath(rawField) 7163 if err != nil { 7164 panic(err) 7165 } 7166 return fp 7167 } 7168 7169 type ActivityLogResourceDifference_FieldTerminalPath struct { 7170 selector ActivityLogResourceDifference_FieldPathSelector 7171 } 7172 7173 var _ ActivityLogResourceDifference_FieldPath = (*ActivityLogResourceDifference_FieldTerminalPath)(nil) 7174 7175 func (fp *ActivityLogResourceDifference_FieldTerminalPath) Selector() ActivityLogResourceDifference_FieldPathSelector { 7176 return fp.selector 7177 } 7178 7179 // String returns path representation in proto convention 7180 func (fp *ActivityLogResourceDifference_FieldTerminalPath) String() string { 7181 return fp.selector.String() 7182 } 7183 7184 // JSONString returns path representation is JSON convention 7185 func (fp *ActivityLogResourceDifference_FieldTerminalPath) JSONString() string { 7186 return strcase.ToLowerCamel(fp.String()) 7187 } 7188 7189 // Get returns all values pointed by specific field from source ActivityLog_Resource_Difference 7190 func (fp *ActivityLogResourceDifference_FieldTerminalPath) Get(source *ActivityLog_Resource_Difference) (values []interface{}) { 7191 if source != nil { 7192 switch fp.selector { 7193 case ActivityLogResourceDifference_FieldPathSelectorFields: 7194 if source.Fields != nil { 7195 values = append(values, source.Fields) 7196 } 7197 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7198 if source.Before != nil { 7199 values = append(values, source.Before) 7200 } 7201 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7202 if source.After != nil { 7203 values = append(values, source.After) 7204 } 7205 default: 7206 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", fp.selector)) 7207 } 7208 } 7209 return 7210 } 7211 7212 func (fp *ActivityLogResourceDifference_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 7213 return fp.Get(source.(*ActivityLog_Resource_Difference)) 7214 } 7215 7216 // GetSingle returns value pointed by specific field of from source ActivityLog_Resource_Difference 7217 func (fp *ActivityLogResourceDifference_FieldTerminalPath) GetSingle(source *ActivityLog_Resource_Difference) (interface{}, bool) { 7218 switch fp.selector { 7219 case ActivityLogResourceDifference_FieldPathSelectorFields: 7220 res := source.GetFields() 7221 return res, res != nil 7222 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7223 res := source.GetBefore() 7224 return res, res != nil 7225 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7226 res := source.GetAfter() 7227 return res, res != nil 7228 default: 7229 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", fp.selector)) 7230 } 7231 } 7232 7233 func (fp *ActivityLogResourceDifference_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 7234 return fp.GetSingle(source.(*ActivityLog_Resource_Difference)) 7235 } 7236 7237 // GetDefault returns a default value of the field type 7238 func (fp *ActivityLogResourceDifference_FieldTerminalPath) GetDefault() interface{} { 7239 switch fp.selector { 7240 case ActivityLogResourceDifference_FieldPathSelectorFields: 7241 return (*fieldmaskpb.FieldMask)(nil) 7242 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7243 return (*anypb.Any)(nil) 7244 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7245 return (*anypb.Any)(nil) 7246 default: 7247 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", fp.selector)) 7248 } 7249 } 7250 7251 func (fp *ActivityLogResourceDifference_FieldTerminalPath) ClearValue(item *ActivityLog_Resource_Difference) { 7252 if item != nil { 7253 switch fp.selector { 7254 case ActivityLogResourceDifference_FieldPathSelectorFields: 7255 item.Fields = nil 7256 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7257 item.Before = nil 7258 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7259 item.After = nil 7260 default: 7261 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", fp.selector)) 7262 } 7263 } 7264 } 7265 7266 func (fp *ActivityLogResourceDifference_FieldTerminalPath) ClearValueRaw(item proto.Message) { 7267 fp.ClearValue(item.(*ActivityLog_Resource_Difference)) 7268 } 7269 7270 // IsLeaf - whether field path is holds simple value 7271 func (fp *ActivityLogResourceDifference_FieldTerminalPath) IsLeaf() bool { 7272 return fp.selector == ActivityLogResourceDifference_FieldPathSelectorFields || 7273 fp.selector == ActivityLogResourceDifference_FieldPathSelectorBefore || 7274 fp.selector == ActivityLogResourceDifference_FieldPathSelectorAfter 7275 } 7276 7277 func (fp *ActivityLogResourceDifference_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 7278 return []gotenobject.FieldPath{fp} 7279 } 7280 7281 func (fp *ActivityLogResourceDifference_FieldTerminalPath) WithIValue(value interface{}) ActivityLogResourceDifference_FieldPathValue { 7282 switch fp.selector { 7283 case ActivityLogResourceDifference_FieldPathSelectorFields: 7284 return &ActivityLogResourceDifference_FieldTerminalPathValue{ActivityLogResourceDifference_FieldTerminalPath: *fp, value: value.(*fieldmaskpb.FieldMask)} 7285 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7286 return &ActivityLogResourceDifference_FieldTerminalPathValue{ActivityLogResourceDifference_FieldTerminalPath: *fp, value: value.(*anypb.Any)} 7287 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7288 return &ActivityLogResourceDifference_FieldTerminalPathValue{ActivityLogResourceDifference_FieldTerminalPath: *fp, value: value.(*anypb.Any)} 7289 default: 7290 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", fp.selector)) 7291 } 7292 } 7293 7294 func (fp *ActivityLogResourceDifference_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 7295 return fp.WithIValue(value) 7296 } 7297 7298 func (fp *ActivityLogResourceDifference_FieldTerminalPath) WithIArrayOfValues(values interface{}) ActivityLogResourceDifference_FieldPathArrayOfValues { 7299 fpaov := &ActivityLogResourceDifference_FieldTerminalPathArrayOfValues{ActivityLogResourceDifference_FieldTerminalPath: *fp} 7300 switch fp.selector { 7301 case ActivityLogResourceDifference_FieldPathSelectorFields: 7302 return &ActivityLogResourceDifference_FieldTerminalPathArrayOfValues{ActivityLogResourceDifference_FieldTerminalPath: *fp, values: values.([]*fieldmaskpb.FieldMask)} 7303 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7304 return &ActivityLogResourceDifference_FieldTerminalPathArrayOfValues{ActivityLogResourceDifference_FieldTerminalPath: *fp, values: values.([]*anypb.Any)} 7305 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7306 return &ActivityLogResourceDifference_FieldTerminalPathArrayOfValues{ActivityLogResourceDifference_FieldTerminalPath: *fp, values: values.([]*anypb.Any)} 7307 default: 7308 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", fp.selector)) 7309 } 7310 return fpaov 7311 } 7312 7313 func (fp *ActivityLogResourceDifference_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 7314 return fp.WithIArrayOfValues(values) 7315 } 7316 7317 func (fp *ActivityLogResourceDifference_FieldTerminalPath) WithIArrayItemValue(value interface{}) ActivityLogResourceDifference_FieldPathArrayItemValue { 7318 switch fp.selector { 7319 default: 7320 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", fp.selector)) 7321 } 7322 } 7323 7324 func (fp *ActivityLogResourceDifference_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 7325 return fp.WithIArrayItemValue(value) 7326 } 7327 7328 // ActivityLogResourceDifference_FieldPathValue allows storing values for Difference fields according to their type 7329 type ActivityLogResourceDifference_FieldPathValue interface { 7330 ActivityLogResourceDifference_FieldPath 7331 gotenobject.FieldPathValue 7332 SetTo(target **ActivityLog_Resource_Difference) 7333 CompareWith(*ActivityLog_Resource_Difference) (cmp int, comparable bool) 7334 } 7335 7336 func ParseActivityLogResourceDifference_FieldPathValue(pathStr, valueStr string) (ActivityLogResourceDifference_FieldPathValue, error) { 7337 fp, err := ParseActivityLogResourceDifference_FieldPath(pathStr) 7338 if err != nil { 7339 return nil, err 7340 } 7341 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 7342 if err != nil { 7343 return nil, status.Errorf(codes.InvalidArgument, "error parsing Difference field path value from %s: %v", valueStr, err) 7344 } 7345 return fpv.(ActivityLogResourceDifference_FieldPathValue), nil 7346 } 7347 7348 func MustParseActivityLogResourceDifference_FieldPathValue(pathStr, valueStr string) ActivityLogResourceDifference_FieldPathValue { 7349 fpv, err := ParseActivityLogResourceDifference_FieldPathValue(pathStr, valueStr) 7350 if err != nil { 7351 panic(err) 7352 } 7353 return fpv 7354 } 7355 7356 type ActivityLogResourceDifference_FieldTerminalPathValue struct { 7357 ActivityLogResourceDifference_FieldTerminalPath 7358 value interface{} 7359 } 7360 7361 var _ ActivityLogResourceDifference_FieldPathValue = (*ActivityLogResourceDifference_FieldTerminalPathValue)(nil) 7362 7363 // GetRawValue returns raw value stored under selected path for 'Difference' as interface{} 7364 func (fpv *ActivityLogResourceDifference_FieldTerminalPathValue) GetRawValue() interface{} { 7365 return fpv.value 7366 } 7367 func (fpv *ActivityLogResourceDifference_FieldTerminalPathValue) AsFieldsValue() (*fieldmaskpb.FieldMask, bool) { 7368 res, ok := fpv.value.(*fieldmaskpb.FieldMask) 7369 return res, ok 7370 } 7371 func (fpv *ActivityLogResourceDifference_FieldTerminalPathValue) AsBeforeValue() (*anypb.Any, bool) { 7372 res, ok := fpv.value.(*anypb.Any) 7373 return res, ok 7374 } 7375 func (fpv *ActivityLogResourceDifference_FieldTerminalPathValue) AsAfterValue() (*anypb.Any, bool) { 7376 res, ok := fpv.value.(*anypb.Any) 7377 return res, ok 7378 } 7379 7380 // SetTo stores value for selected field for object Difference 7381 func (fpv *ActivityLogResourceDifference_FieldTerminalPathValue) SetTo(target **ActivityLog_Resource_Difference) { 7382 if *target == nil { 7383 *target = new(ActivityLog_Resource_Difference) 7384 } 7385 switch fpv.selector { 7386 case ActivityLogResourceDifference_FieldPathSelectorFields: 7387 (*target).Fields = fpv.value.(*fieldmaskpb.FieldMask) 7388 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7389 (*target).Before = fpv.value.(*anypb.Any) 7390 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7391 (*target).After = fpv.value.(*anypb.Any) 7392 default: 7393 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", fpv.selector)) 7394 } 7395 } 7396 7397 func (fpv *ActivityLogResourceDifference_FieldTerminalPathValue) SetToRaw(target proto.Message) { 7398 typedObject := target.(*ActivityLog_Resource_Difference) 7399 fpv.SetTo(&typedObject) 7400 } 7401 7402 // CompareWith compares value in the 'ActivityLogResourceDifference_FieldTerminalPathValue' with the value under path in 'ActivityLog_Resource_Difference'. 7403 func (fpv *ActivityLogResourceDifference_FieldTerminalPathValue) CompareWith(source *ActivityLog_Resource_Difference) (int, bool) { 7404 switch fpv.selector { 7405 case ActivityLogResourceDifference_FieldPathSelectorFields: 7406 return 0, false 7407 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7408 return 0, false 7409 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7410 return 0, false 7411 default: 7412 panic(fmt.Sprintf("Invalid selector for ActivityLog_Resource_Difference: %d", fpv.selector)) 7413 } 7414 } 7415 7416 func (fpv *ActivityLogResourceDifference_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 7417 return fpv.CompareWith(source.(*ActivityLog_Resource_Difference)) 7418 } 7419 7420 // ActivityLogResourceDifference_FieldPathArrayItemValue allows storing single item in Path-specific values for Difference according to their type 7421 // Present only for array (repeated) types. 7422 type ActivityLogResourceDifference_FieldPathArrayItemValue interface { 7423 gotenobject.FieldPathArrayItemValue 7424 ActivityLogResourceDifference_FieldPath 7425 ContainsValue(*ActivityLog_Resource_Difference) bool 7426 } 7427 7428 // ParseActivityLogResourceDifference_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 7429 func ParseActivityLogResourceDifference_FieldPathArrayItemValue(pathStr, valueStr string) (ActivityLogResourceDifference_FieldPathArrayItemValue, error) { 7430 fp, err := ParseActivityLogResourceDifference_FieldPath(pathStr) 7431 if err != nil { 7432 return nil, err 7433 } 7434 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 7435 if err != nil { 7436 return nil, status.Errorf(codes.InvalidArgument, "error parsing Difference field path array item value from %s: %v", valueStr, err) 7437 } 7438 return fpaiv.(ActivityLogResourceDifference_FieldPathArrayItemValue), nil 7439 } 7440 7441 func MustParseActivityLogResourceDifference_FieldPathArrayItemValue(pathStr, valueStr string) ActivityLogResourceDifference_FieldPathArrayItemValue { 7442 fpaiv, err := ParseActivityLogResourceDifference_FieldPathArrayItemValue(pathStr, valueStr) 7443 if err != nil { 7444 panic(err) 7445 } 7446 return fpaiv 7447 } 7448 7449 type ActivityLogResourceDifference_FieldTerminalPathArrayItemValue struct { 7450 ActivityLogResourceDifference_FieldTerminalPath 7451 value interface{} 7452 } 7453 7454 var _ ActivityLogResourceDifference_FieldPathArrayItemValue = (*ActivityLogResourceDifference_FieldTerminalPathArrayItemValue)(nil) 7455 7456 // GetRawValue returns stored element value for array in object ActivityLog_Resource_Difference as interface{} 7457 func (fpaiv *ActivityLogResourceDifference_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 7458 return fpaiv.value 7459 } 7460 7461 func (fpaiv *ActivityLogResourceDifference_FieldTerminalPathArrayItemValue) GetSingle(source *ActivityLog_Resource_Difference) (interface{}, bool) { 7462 return nil, false 7463 } 7464 7465 func (fpaiv *ActivityLogResourceDifference_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 7466 return fpaiv.GetSingle(source.(*ActivityLog_Resource_Difference)) 7467 } 7468 7469 // Contains returns a boolean indicating if value that is being held is present in given 'Difference' 7470 func (fpaiv *ActivityLogResourceDifference_FieldTerminalPathArrayItemValue) ContainsValue(source *ActivityLog_Resource_Difference) bool { 7471 slice := fpaiv.ActivityLogResourceDifference_FieldTerminalPath.Get(source) 7472 for _, v := range slice { 7473 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 7474 if proto.Equal(asProtoMsg, v.(proto.Message)) { 7475 return true 7476 } 7477 } else if reflect.DeepEqual(v, fpaiv.value) { 7478 return true 7479 } 7480 } 7481 return false 7482 } 7483 7484 // ActivityLogResourceDifference_FieldPathArrayOfValues allows storing slice of values for Difference fields according to their type 7485 type ActivityLogResourceDifference_FieldPathArrayOfValues interface { 7486 gotenobject.FieldPathArrayOfValues 7487 ActivityLogResourceDifference_FieldPath 7488 } 7489 7490 func ParseActivityLogResourceDifference_FieldPathArrayOfValues(pathStr, valuesStr string) (ActivityLogResourceDifference_FieldPathArrayOfValues, error) { 7491 fp, err := ParseActivityLogResourceDifference_FieldPath(pathStr) 7492 if err != nil { 7493 return nil, err 7494 } 7495 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 7496 if err != nil { 7497 return nil, status.Errorf(codes.InvalidArgument, "error parsing Difference field path array of values from %s: %v", valuesStr, err) 7498 } 7499 return fpaov.(ActivityLogResourceDifference_FieldPathArrayOfValues), nil 7500 } 7501 7502 func MustParseActivityLogResourceDifference_FieldPathArrayOfValues(pathStr, valuesStr string) ActivityLogResourceDifference_FieldPathArrayOfValues { 7503 fpaov, err := ParseActivityLogResourceDifference_FieldPathArrayOfValues(pathStr, valuesStr) 7504 if err != nil { 7505 panic(err) 7506 } 7507 return fpaov 7508 } 7509 7510 type ActivityLogResourceDifference_FieldTerminalPathArrayOfValues struct { 7511 ActivityLogResourceDifference_FieldTerminalPath 7512 values interface{} 7513 } 7514 7515 var _ ActivityLogResourceDifference_FieldPathArrayOfValues = (*ActivityLogResourceDifference_FieldTerminalPathArrayOfValues)(nil) 7516 7517 func (fpaov *ActivityLogResourceDifference_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 7518 switch fpaov.selector { 7519 case ActivityLogResourceDifference_FieldPathSelectorFields: 7520 for _, v := range fpaov.values.([]*fieldmaskpb.FieldMask) { 7521 values = append(values, v) 7522 } 7523 case ActivityLogResourceDifference_FieldPathSelectorBefore: 7524 for _, v := range fpaov.values.([]*anypb.Any) { 7525 values = append(values, v) 7526 } 7527 case ActivityLogResourceDifference_FieldPathSelectorAfter: 7528 for _, v := range fpaov.values.([]*anypb.Any) { 7529 values = append(values, v) 7530 } 7531 } 7532 return 7533 } 7534 func (fpaov *ActivityLogResourceDifference_FieldTerminalPathArrayOfValues) AsFieldsArrayOfValues() ([]*fieldmaskpb.FieldMask, bool) { 7535 res, ok := fpaov.values.([]*fieldmaskpb.FieldMask) 7536 return res, ok 7537 } 7538 func (fpaov *ActivityLogResourceDifference_FieldTerminalPathArrayOfValues) AsBeforeArrayOfValues() ([]*anypb.Any, bool) { 7539 res, ok := fpaov.values.([]*anypb.Any) 7540 return res, ok 7541 } 7542 func (fpaov *ActivityLogResourceDifference_FieldTerminalPathArrayOfValues) AsAfterArrayOfValues() ([]*anypb.Any, bool) { 7543 res, ok := fpaov.values.([]*anypb.Any) 7544 return res, ok 7545 }