github.com/cloudwan/edgelq-sdk@v1.15.4/limits/resources/v1alpha2/plan_assignment_request/plan_assignment_request.pb.fieldpath.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/limits/proto/v1alpha2/plan_assignment_request.proto 3 // DO NOT EDIT!!! 4 5 package plan_assignment_request 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 iam_organization "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/organization" 27 iam_project "github.com/cloudwan/edgelq-sdk/iam/resources/v1alpha2/project" 28 common "github.com/cloudwan/edgelq-sdk/limits/resources/v1alpha2/common" 29 plan "github.com/cloudwan/edgelq-sdk/limits/resources/v1alpha2/plan" 30 plan_assignment "github.com/cloudwan/edgelq-sdk/limits/resources/v1alpha2/plan_assignment" 31 meta_service "github.com/cloudwan/edgelq-sdk/meta/resources/v1alpha2/service" 32 meta "github.com/cloudwan/goten-sdk/types/meta" 33 ) 34 35 // ensure the imports are used 36 var ( 37 _ = new(json.Marshaler) 38 _ = new(fmt.Stringer) 39 _ = reflect.DeepEqual 40 _ = strings.Builder{} 41 _ = time.Second 42 43 _ = strcase.ToLowerCamel 44 _ = codes.NotFound 45 _ = status.Status{} 46 _ = protojson.UnmarshalOptions{} 47 _ = new(proto.Message) 48 _ = protoregistry.GlobalTypes 49 50 _ = new(gotenobject.FieldPath) 51 ) 52 53 // make sure we're using proto imports 54 var ( 55 _ = &iam_organization.Organization{} 56 _ = &iam_project.Project{} 57 _ = &common.Allowance{} 58 _ = &plan.Plan{} 59 _ = &plan_assignment.PlanAssignment{} 60 _ = &meta_service.Service{} 61 _ = &meta.Meta{} 62 ) 63 64 // FieldPath provides implementation to handle 65 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 66 type PlanAssignmentRequest_FieldPath interface { 67 gotenobject.FieldPath 68 Selector() PlanAssignmentRequest_FieldPathSelector 69 Get(source *PlanAssignmentRequest) []interface{} 70 GetSingle(source *PlanAssignmentRequest) (interface{}, bool) 71 ClearValue(item *PlanAssignmentRequest) 72 73 // Those methods build corresponding PlanAssignmentRequest_FieldPathValue 74 // (or array of values) and holds passed value. Panics if injected type is incorrect. 75 WithIValue(value interface{}) PlanAssignmentRequest_FieldPathValue 76 WithIArrayOfValues(values interface{}) PlanAssignmentRequest_FieldPathArrayOfValues 77 WithIArrayItemValue(value interface{}) PlanAssignmentRequest_FieldPathArrayItemValue 78 } 79 80 type PlanAssignmentRequest_FieldPathSelector int32 81 82 const ( 83 PlanAssignmentRequest_FieldPathSelectorName PlanAssignmentRequest_FieldPathSelector = 0 84 PlanAssignmentRequest_FieldPathSelectorRequest PlanAssignmentRequest_FieldPathSelector = 1 85 PlanAssignmentRequest_FieldPathSelectorService PlanAssignmentRequest_FieldPathSelector = 2 86 PlanAssignmentRequest_FieldPathSelectorApprover PlanAssignmentRequest_FieldPathSelector = 3 87 PlanAssignmentRequest_FieldPathSelectorStatus PlanAssignmentRequest_FieldPathSelector = 4 88 PlanAssignmentRequest_FieldPathSelectorMetadata PlanAssignmentRequest_FieldPathSelector = 5 89 ) 90 91 func (s PlanAssignmentRequest_FieldPathSelector) String() string { 92 switch s { 93 case PlanAssignmentRequest_FieldPathSelectorName: 94 return "name" 95 case PlanAssignmentRequest_FieldPathSelectorRequest: 96 return "request" 97 case PlanAssignmentRequest_FieldPathSelectorService: 98 return "service" 99 case PlanAssignmentRequest_FieldPathSelectorApprover: 100 return "approver" 101 case PlanAssignmentRequest_FieldPathSelectorStatus: 102 return "status" 103 case PlanAssignmentRequest_FieldPathSelectorMetadata: 104 return "metadata" 105 default: 106 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", s)) 107 } 108 } 109 110 func BuildPlanAssignmentRequest_FieldPath(fp gotenobject.RawFieldPath) (PlanAssignmentRequest_FieldPath, error) { 111 if len(fp) == 0 { 112 return nil, status.Error(codes.InvalidArgument, "empty field path for object PlanAssignmentRequest") 113 } 114 if len(fp) == 1 { 115 switch fp[0] { 116 case "name": 117 return &PlanAssignmentRequest_FieldTerminalPath{selector: PlanAssignmentRequest_FieldPathSelectorName}, nil 118 case "request": 119 return &PlanAssignmentRequest_FieldTerminalPath{selector: PlanAssignmentRequest_FieldPathSelectorRequest}, nil 120 case "service": 121 return &PlanAssignmentRequest_FieldTerminalPath{selector: PlanAssignmentRequest_FieldPathSelectorService}, nil 122 case "approver": 123 return &PlanAssignmentRequest_FieldTerminalPath{selector: PlanAssignmentRequest_FieldPathSelectorApprover}, nil 124 case "status": 125 return &PlanAssignmentRequest_FieldTerminalPath{selector: PlanAssignmentRequest_FieldPathSelectorStatus}, nil 126 case "metadata": 127 return &PlanAssignmentRequest_FieldTerminalPath{selector: PlanAssignmentRequest_FieldPathSelectorMetadata}, nil 128 } 129 } else { 130 switch fp[0] { 131 case "request": 132 if subpath, err := BuildPlanAssignmentRequestRequestType_FieldPath(fp[1:]); err != nil { 133 return nil, err 134 } else { 135 return &PlanAssignmentRequest_FieldSubPath{selector: PlanAssignmentRequest_FieldPathSelectorRequest, subPath: subpath}, nil 136 } 137 case "status": 138 if subpath, err := BuildPlanAssignmentRequestStatus_FieldPath(fp[1:]); err != nil { 139 return nil, err 140 } else { 141 return &PlanAssignmentRequest_FieldSubPath{selector: PlanAssignmentRequest_FieldPathSelectorStatus, subPath: subpath}, nil 142 } 143 case "metadata": 144 if subpath, err := meta.BuildMeta_FieldPath(fp[1:]); err != nil { 145 return nil, err 146 } else { 147 return &PlanAssignmentRequest_FieldSubPath{selector: PlanAssignmentRequest_FieldPathSelectorMetadata, subPath: subpath}, nil 148 } 149 } 150 } 151 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PlanAssignmentRequest", fp) 152 } 153 154 func ParsePlanAssignmentRequest_FieldPath(rawField string) (PlanAssignmentRequest_FieldPath, error) { 155 fp, err := gotenobject.ParseRawFieldPath(rawField) 156 if err != nil { 157 return nil, err 158 } 159 return BuildPlanAssignmentRequest_FieldPath(fp) 160 } 161 162 func MustParsePlanAssignmentRequest_FieldPath(rawField string) PlanAssignmentRequest_FieldPath { 163 fp, err := ParsePlanAssignmentRequest_FieldPath(rawField) 164 if err != nil { 165 panic(err) 166 } 167 return fp 168 } 169 170 type PlanAssignmentRequest_FieldTerminalPath struct { 171 selector PlanAssignmentRequest_FieldPathSelector 172 } 173 174 var _ PlanAssignmentRequest_FieldPath = (*PlanAssignmentRequest_FieldTerminalPath)(nil) 175 176 func (fp *PlanAssignmentRequest_FieldTerminalPath) Selector() PlanAssignmentRequest_FieldPathSelector { 177 return fp.selector 178 } 179 180 // String returns path representation in proto convention 181 func (fp *PlanAssignmentRequest_FieldTerminalPath) String() string { 182 return fp.selector.String() 183 } 184 185 // JSONString returns path representation is JSON convention 186 func (fp *PlanAssignmentRequest_FieldTerminalPath) JSONString() string { 187 return strcase.ToLowerCamel(fp.String()) 188 } 189 190 // Get returns all values pointed by specific field from source PlanAssignmentRequest 191 func (fp *PlanAssignmentRequest_FieldTerminalPath) Get(source *PlanAssignmentRequest) (values []interface{}) { 192 if source != nil { 193 switch fp.selector { 194 case PlanAssignmentRequest_FieldPathSelectorName: 195 if source.Name != nil { 196 values = append(values, source.Name) 197 } 198 case PlanAssignmentRequest_FieldPathSelectorRequest: 199 if source.Request != nil { 200 values = append(values, source.Request) 201 } 202 case PlanAssignmentRequest_FieldPathSelectorService: 203 if source.Service != nil { 204 values = append(values, source.Service) 205 } 206 case PlanAssignmentRequest_FieldPathSelectorApprover: 207 if source.Approver != nil { 208 values = append(values, source.Approver) 209 } 210 case PlanAssignmentRequest_FieldPathSelectorStatus: 211 if source.Status != nil { 212 values = append(values, source.Status) 213 } 214 case PlanAssignmentRequest_FieldPathSelectorMetadata: 215 if source.Metadata != nil { 216 values = append(values, source.Metadata) 217 } 218 default: 219 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fp.selector)) 220 } 221 } 222 return 223 } 224 225 func (fp *PlanAssignmentRequest_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 226 return fp.Get(source.(*PlanAssignmentRequest)) 227 } 228 229 // GetSingle returns value pointed by specific field of from source PlanAssignmentRequest 230 func (fp *PlanAssignmentRequest_FieldTerminalPath) GetSingle(source *PlanAssignmentRequest) (interface{}, bool) { 231 switch fp.selector { 232 case PlanAssignmentRequest_FieldPathSelectorName: 233 res := source.GetName() 234 return res, res != nil 235 case PlanAssignmentRequest_FieldPathSelectorRequest: 236 res := source.GetRequest() 237 return res, res != nil 238 case PlanAssignmentRequest_FieldPathSelectorService: 239 res := source.GetService() 240 return res, res != nil 241 case PlanAssignmentRequest_FieldPathSelectorApprover: 242 res := source.GetApprover() 243 return res, res != nil 244 case PlanAssignmentRequest_FieldPathSelectorStatus: 245 res := source.GetStatus() 246 return res, res != nil 247 case PlanAssignmentRequest_FieldPathSelectorMetadata: 248 res := source.GetMetadata() 249 return res, res != nil 250 default: 251 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fp.selector)) 252 } 253 } 254 255 func (fp *PlanAssignmentRequest_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 256 return fp.GetSingle(source.(*PlanAssignmentRequest)) 257 } 258 259 // GetDefault returns a default value of the field type 260 func (fp *PlanAssignmentRequest_FieldTerminalPath) GetDefault() interface{} { 261 switch fp.selector { 262 case PlanAssignmentRequest_FieldPathSelectorName: 263 return (*Name)(nil) 264 case PlanAssignmentRequest_FieldPathSelectorRequest: 265 return (*PlanAssignmentRequest_RequestType)(nil) 266 case PlanAssignmentRequest_FieldPathSelectorService: 267 return (*meta_service.Reference)(nil) 268 case PlanAssignmentRequest_FieldPathSelectorApprover: 269 return (*iam_organization.Reference)(nil) 270 case PlanAssignmentRequest_FieldPathSelectorStatus: 271 return (*PlanAssignmentRequest_Status)(nil) 272 case PlanAssignmentRequest_FieldPathSelectorMetadata: 273 return (*meta.Meta)(nil) 274 default: 275 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fp.selector)) 276 } 277 } 278 279 func (fp *PlanAssignmentRequest_FieldTerminalPath) ClearValue(item *PlanAssignmentRequest) { 280 if item != nil { 281 switch fp.selector { 282 case PlanAssignmentRequest_FieldPathSelectorName: 283 item.Name = nil 284 case PlanAssignmentRequest_FieldPathSelectorRequest: 285 item.Request = nil 286 case PlanAssignmentRequest_FieldPathSelectorService: 287 item.Service = nil 288 case PlanAssignmentRequest_FieldPathSelectorApprover: 289 item.Approver = nil 290 case PlanAssignmentRequest_FieldPathSelectorStatus: 291 item.Status = nil 292 case PlanAssignmentRequest_FieldPathSelectorMetadata: 293 item.Metadata = nil 294 default: 295 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fp.selector)) 296 } 297 } 298 } 299 300 func (fp *PlanAssignmentRequest_FieldTerminalPath) ClearValueRaw(item proto.Message) { 301 fp.ClearValue(item.(*PlanAssignmentRequest)) 302 } 303 304 // IsLeaf - whether field path is holds simple value 305 func (fp *PlanAssignmentRequest_FieldTerminalPath) IsLeaf() bool { 306 return fp.selector == PlanAssignmentRequest_FieldPathSelectorName || 307 fp.selector == PlanAssignmentRequest_FieldPathSelectorService || 308 fp.selector == PlanAssignmentRequest_FieldPathSelectorApprover 309 } 310 311 func (fp *PlanAssignmentRequest_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 312 return []gotenobject.FieldPath{fp} 313 } 314 315 func (fp *PlanAssignmentRequest_FieldTerminalPath) WithIValue(value interface{}) PlanAssignmentRequest_FieldPathValue { 316 switch fp.selector { 317 case PlanAssignmentRequest_FieldPathSelectorName: 318 return &PlanAssignmentRequest_FieldTerminalPathValue{PlanAssignmentRequest_FieldTerminalPath: *fp, value: value.(*Name)} 319 case PlanAssignmentRequest_FieldPathSelectorRequest: 320 return &PlanAssignmentRequest_FieldTerminalPathValue{PlanAssignmentRequest_FieldTerminalPath: *fp, value: value.(*PlanAssignmentRequest_RequestType)} 321 case PlanAssignmentRequest_FieldPathSelectorService: 322 return &PlanAssignmentRequest_FieldTerminalPathValue{PlanAssignmentRequest_FieldTerminalPath: *fp, value: value.(*meta_service.Reference)} 323 case PlanAssignmentRequest_FieldPathSelectorApprover: 324 return &PlanAssignmentRequest_FieldTerminalPathValue{PlanAssignmentRequest_FieldTerminalPath: *fp, value: value.(*iam_organization.Reference)} 325 case PlanAssignmentRequest_FieldPathSelectorStatus: 326 return &PlanAssignmentRequest_FieldTerminalPathValue{PlanAssignmentRequest_FieldTerminalPath: *fp, value: value.(*PlanAssignmentRequest_Status)} 327 case PlanAssignmentRequest_FieldPathSelectorMetadata: 328 return &PlanAssignmentRequest_FieldTerminalPathValue{PlanAssignmentRequest_FieldTerminalPath: *fp, value: value.(*meta.Meta)} 329 default: 330 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fp.selector)) 331 } 332 } 333 334 func (fp *PlanAssignmentRequest_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 335 return fp.WithIValue(value) 336 } 337 338 func (fp *PlanAssignmentRequest_FieldTerminalPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequest_FieldPathArrayOfValues { 339 fpaov := &PlanAssignmentRequest_FieldTerminalPathArrayOfValues{PlanAssignmentRequest_FieldTerminalPath: *fp} 340 switch fp.selector { 341 case PlanAssignmentRequest_FieldPathSelectorName: 342 return &PlanAssignmentRequest_FieldTerminalPathArrayOfValues{PlanAssignmentRequest_FieldTerminalPath: *fp, values: values.([]*Name)} 343 case PlanAssignmentRequest_FieldPathSelectorRequest: 344 return &PlanAssignmentRequest_FieldTerminalPathArrayOfValues{PlanAssignmentRequest_FieldTerminalPath: *fp, values: values.([]*PlanAssignmentRequest_RequestType)} 345 case PlanAssignmentRequest_FieldPathSelectorService: 346 return &PlanAssignmentRequest_FieldTerminalPathArrayOfValues{PlanAssignmentRequest_FieldTerminalPath: *fp, values: values.([]*meta_service.Reference)} 347 case PlanAssignmentRequest_FieldPathSelectorApprover: 348 return &PlanAssignmentRequest_FieldTerminalPathArrayOfValues{PlanAssignmentRequest_FieldTerminalPath: *fp, values: values.([]*iam_organization.Reference)} 349 case PlanAssignmentRequest_FieldPathSelectorStatus: 350 return &PlanAssignmentRequest_FieldTerminalPathArrayOfValues{PlanAssignmentRequest_FieldTerminalPath: *fp, values: values.([]*PlanAssignmentRequest_Status)} 351 case PlanAssignmentRequest_FieldPathSelectorMetadata: 352 return &PlanAssignmentRequest_FieldTerminalPathArrayOfValues{PlanAssignmentRequest_FieldTerminalPath: *fp, values: values.([]*meta.Meta)} 353 default: 354 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fp.selector)) 355 } 356 return fpaov 357 } 358 359 func (fp *PlanAssignmentRequest_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 360 return fp.WithIArrayOfValues(values) 361 } 362 363 func (fp *PlanAssignmentRequest_FieldTerminalPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequest_FieldPathArrayItemValue { 364 switch fp.selector { 365 default: 366 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fp.selector)) 367 } 368 } 369 370 func (fp *PlanAssignmentRequest_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 371 return fp.WithIArrayItemValue(value) 372 } 373 374 type PlanAssignmentRequest_FieldSubPath struct { 375 selector PlanAssignmentRequest_FieldPathSelector 376 subPath gotenobject.FieldPath 377 } 378 379 var _ PlanAssignmentRequest_FieldPath = (*PlanAssignmentRequest_FieldSubPath)(nil) 380 381 func (fps *PlanAssignmentRequest_FieldSubPath) Selector() PlanAssignmentRequest_FieldPathSelector { 382 return fps.selector 383 } 384 func (fps *PlanAssignmentRequest_FieldSubPath) AsRequestSubPath() (PlanAssignmentRequestRequestType_FieldPath, bool) { 385 res, ok := fps.subPath.(PlanAssignmentRequestRequestType_FieldPath) 386 return res, ok 387 } 388 func (fps *PlanAssignmentRequest_FieldSubPath) AsStatusSubPath() (PlanAssignmentRequestStatus_FieldPath, bool) { 389 res, ok := fps.subPath.(PlanAssignmentRequestStatus_FieldPath) 390 return res, ok 391 } 392 func (fps *PlanAssignmentRequest_FieldSubPath) AsMetadataSubPath() (meta.Meta_FieldPath, bool) { 393 res, ok := fps.subPath.(meta.Meta_FieldPath) 394 return res, ok 395 } 396 397 // String returns path representation in proto convention 398 func (fps *PlanAssignmentRequest_FieldSubPath) String() string { 399 return fps.selector.String() + "." + fps.subPath.String() 400 } 401 402 // JSONString returns path representation is JSON convention 403 func (fps *PlanAssignmentRequest_FieldSubPath) JSONString() string { 404 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 405 } 406 407 // Get returns all values pointed by selected field from source PlanAssignmentRequest 408 func (fps *PlanAssignmentRequest_FieldSubPath) Get(source *PlanAssignmentRequest) (values []interface{}) { 409 switch fps.selector { 410 case PlanAssignmentRequest_FieldPathSelectorRequest: 411 values = append(values, fps.subPath.GetRaw(source.GetRequest())...) 412 case PlanAssignmentRequest_FieldPathSelectorStatus: 413 values = append(values, fps.subPath.GetRaw(source.GetStatus())...) 414 case PlanAssignmentRequest_FieldPathSelectorMetadata: 415 values = append(values, fps.subPath.GetRaw(source.GetMetadata())...) 416 default: 417 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fps.selector)) 418 } 419 return 420 } 421 422 func (fps *PlanAssignmentRequest_FieldSubPath) GetRaw(source proto.Message) []interface{} { 423 return fps.Get(source.(*PlanAssignmentRequest)) 424 } 425 426 // GetSingle returns value of selected field from source PlanAssignmentRequest 427 func (fps *PlanAssignmentRequest_FieldSubPath) GetSingle(source *PlanAssignmentRequest) (interface{}, bool) { 428 switch fps.selector { 429 case PlanAssignmentRequest_FieldPathSelectorRequest: 430 if source.GetRequest() == nil { 431 return nil, false 432 } 433 return fps.subPath.GetSingleRaw(source.GetRequest()) 434 case PlanAssignmentRequest_FieldPathSelectorStatus: 435 if source.GetStatus() == nil { 436 return nil, false 437 } 438 return fps.subPath.GetSingleRaw(source.GetStatus()) 439 case PlanAssignmentRequest_FieldPathSelectorMetadata: 440 if source.GetMetadata() == nil { 441 return nil, false 442 } 443 return fps.subPath.GetSingleRaw(source.GetMetadata()) 444 default: 445 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fps.selector)) 446 } 447 } 448 449 func (fps *PlanAssignmentRequest_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 450 return fps.GetSingle(source.(*PlanAssignmentRequest)) 451 } 452 453 // GetDefault returns a default value of the field type 454 func (fps *PlanAssignmentRequest_FieldSubPath) GetDefault() interface{} { 455 return fps.subPath.GetDefault() 456 } 457 458 func (fps *PlanAssignmentRequest_FieldSubPath) ClearValue(item *PlanAssignmentRequest) { 459 if item != nil { 460 switch fps.selector { 461 case PlanAssignmentRequest_FieldPathSelectorRequest: 462 fps.subPath.ClearValueRaw(item.Request) 463 case PlanAssignmentRequest_FieldPathSelectorStatus: 464 fps.subPath.ClearValueRaw(item.Status) 465 case PlanAssignmentRequest_FieldPathSelectorMetadata: 466 fps.subPath.ClearValueRaw(item.Metadata) 467 default: 468 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fps.selector)) 469 } 470 } 471 } 472 473 func (fps *PlanAssignmentRequest_FieldSubPath) ClearValueRaw(item proto.Message) { 474 fps.ClearValue(item.(*PlanAssignmentRequest)) 475 } 476 477 // IsLeaf - whether field path is holds simple value 478 func (fps *PlanAssignmentRequest_FieldSubPath) IsLeaf() bool { 479 return fps.subPath.IsLeaf() 480 } 481 482 func (fps *PlanAssignmentRequest_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 483 iPaths := []gotenobject.FieldPath{&PlanAssignmentRequest_FieldTerminalPath{selector: fps.selector}} 484 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 485 return iPaths 486 } 487 488 func (fps *PlanAssignmentRequest_FieldSubPath) WithIValue(value interface{}) PlanAssignmentRequest_FieldPathValue { 489 return &PlanAssignmentRequest_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 490 } 491 492 func (fps *PlanAssignmentRequest_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 493 return fps.WithIValue(value) 494 } 495 496 func (fps *PlanAssignmentRequest_FieldSubPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequest_FieldPathArrayOfValues { 497 return &PlanAssignmentRequest_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 498 } 499 500 func (fps *PlanAssignmentRequest_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 501 return fps.WithIArrayOfValues(values) 502 } 503 504 func (fps *PlanAssignmentRequest_FieldSubPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequest_FieldPathArrayItemValue { 505 return &PlanAssignmentRequest_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 506 } 507 508 func (fps *PlanAssignmentRequest_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 509 return fps.WithIArrayItemValue(value) 510 } 511 512 // PlanAssignmentRequest_FieldPathValue allows storing values for PlanAssignmentRequest fields according to their type 513 type PlanAssignmentRequest_FieldPathValue interface { 514 PlanAssignmentRequest_FieldPath 515 gotenobject.FieldPathValue 516 SetTo(target **PlanAssignmentRequest) 517 CompareWith(*PlanAssignmentRequest) (cmp int, comparable bool) 518 } 519 520 func ParsePlanAssignmentRequest_FieldPathValue(pathStr, valueStr string) (PlanAssignmentRequest_FieldPathValue, error) { 521 fp, err := ParsePlanAssignmentRequest_FieldPath(pathStr) 522 if err != nil { 523 return nil, err 524 } 525 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 526 if err != nil { 527 return nil, status.Errorf(codes.InvalidArgument, "error parsing PlanAssignmentRequest field path value from %s: %v", valueStr, err) 528 } 529 return fpv.(PlanAssignmentRequest_FieldPathValue), nil 530 } 531 532 func MustParsePlanAssignmentRequest_FieldPathValue(pathStr, valueStr string) PlanAssignmentRequest_FieldPathValue { 533 fpv, err := ParsePlanAssignmentRequest_FieldPathValue(pathStr, valueStr) 534 if err != nil { 535 panic(err) 536 } 537 return fpv 538 } 539 540 type PlanAssignmentRequest_FieldTerminalPathValue struct { 541 PlanAssignmentRequest_FieldTerminalPath 542 value interface{} 543 } 544 545 var _ PlanAssignmentRequest_FieldPathValue = (*PlanAssignmentRequest_FieldTerminalPathValue)(nil) 546 547 // GetRawValue returns raw value stored under selected path for 'PlanAssignmentRequest' as interface{} 548 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) GetRawValue() interface{} { 549 return fpv.value 550 } 551 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) AsNameValue() (*Name, bool) { 552 res, ok := fpv.value.(*Name) 553 return res, ok 554 } 555 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) AsRequestValue() (*PlanAssignmentRequest_RequestType, bool) { 556 res, ok := fpv.value.(*PlanAssignmentRequest_RequestType) 557 return res, ok 558 } 559 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) AsServiceValue() (*meta_service.Reference, bool) { 560 res, ok := fpv.value.(*meta_service.Reference) 561 return res, ok 562 } 563 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) AsApproverValue() (*iam_organization.Reference, bool) { 564 res, ok := fpv.value.(*iam_organization.Reference) 565 return res, ok 566 } 567 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) AsStatusValue() (*PlanAssignmentRequest_Status, bool) { 568 res, ok := fpv.value.(*PlanAssignmentRequest_Status) 569 return res, ok 570 } 571 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) AsMetadataValue() (*meta.Meta, bool) { 572 res, ok := fpv.value.(*meta.Meta) 573 return res, ok 574 } 575 576 // SetTo stores value for selected field for object PlanAssignmentRequest 577 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) SetTo(target **PlanAssignmentRequest) { 578 if *target == nil { 579 *target = new(PlanAssignmentRequest) 580 } 581 switch fpv.selector { 582 case PlanAssignmentRequest_FieldPathSelectorName: 583 (*target).Name = fpv.value.(*Name) 584 case PlanAssignmentRequest_FieldPathSelectorRequest: 585 (*target).Request = fpv.value.(*PlanAssignmentRequest_RequestType) 586 case PlanAssignmentRequest_FieldPathSelectorService: 587 (*target).Service = fpv.value.(*meta_service.Reference) 588 case PlanAssignmentRequest_FieldPathSelectorApprover: 589 (*target).Approver = fpv.value.(*iam_organization.Reference) 590 case PlanAssignmentRequest_FieldPathSelectorStatus: 591 (*target).Status = fpv.value.(*PlanAssignmentRequest_Status) 592 case PlanAssignmentRequest_FieldPathSelectorMetadata: 593 (*target).Metadata = fpv.value.(*meta.Meta) 594 default: 595 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fpv.selector)) 596 } 597 } 598 599 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) SetToRaw(target proto.Message) { 600 typedObject := target.(*PlanAssignmentRequest) 601 fpv.SetTo(&typedObject) 602 } 603 604 // CompareWith compares value in the 'PlanAssignmentRequest_FieldTerminalPathValue' with the value under path in 'PlanAssignmentRequest'. 605 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) CompareWith(source *PlanAssignmentRequest) (int, bool) { 606 switch fpv.selector { 607 case PlanAssignmentRequest_FieldPathSelectorName: 608 leftValue := fpv.value.(*Name) 609 rightValue := source.GetName() 610 if leftValue == nil { 611 if rightValue != nil { 612 return -1, true 613 } 614 return 0, true 615 } 616 if rightValue == nil { 617 return 1, true 618 } 619 if leftValue.String() == rightValue.String() { 620 return 0, true 621 } else if leftValue.String() < rightValue.String() { 622 return -1, true 623 } else { 624 return 1, true 625 } 626 case PlanAssignmentRequest_FieldPathSelectorRequest: 627 return 0, false 628 case PlanAssignmentRequest_FieldPathSelectorService: 629 leftValue := fpv.value.(*meta_service.Reference) 630 rightValue := source.GetService() 631 if leftValue == nil { 632 if rightValue != nil { 633 return -1, true 634 } 635 return 0, true 636 } 637 if rightValue == nil { 638 return 1, true 639 } 640 if leftValue.String() == rightValue.String() { 641 return 0, true 642 } else if leftValue.String() < rightValue.String() { 643 return -1, true 644 } else { 645 return 1, true 646 } 647 case PlanAssignmentRequest_FieldPathSelectorApprover: 648 leftValue := fpv.value.(*iam_organization.Reference) 649 rightValue := source.GetApprover() 650 if leftValue == nil { 651 if rightValue != nil { 652 return -1, true 653 } 654 return 0, true 655 } 656 if rightValue == nil { 657 return 1, true 658 } 659 if leftValue.String() == rightValue.String() { 660 return 0, true 661 } else if leftValue.String() < rightValue.String() { 662 return -1, true 663 } else { 664 return 1, true 665 } 666 case PlanAssignmentRequest_FieldPathSelectorStatus: 667 return 0, false 668 case PlanAssignmentRequest_FieldPathSelectorMetadata: 669 return 0, false 670 default: 671 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fpv.selector)) 672 } 673 } 674 675 func (fpv *PlanAssignmentRequest_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 676 return fpv.CompareWith(source.(*PlanAssignmentRequest)) 677 } 678 679 type PlanAssignmentRequest_FieldSubPathValue struct { 680 PlanAssignmentRequest_FieldPath 681 subPathValue gotenobject.FieldPathValue 682 } 683 684 var _ PlanAssignmentRequest_FieldPathValue = (*PlanAssignmentRequest_FieldSubPathValue)(nil) 685 686 func (fpvs *PlanAssignmentRequest_FieldSubPathValue) AsRequestPathValue() (PlanAssignmentRequestRequestType_FieldPathValue, bool) { 687 res, ok := fpvs.subPathValue.(PlanAssignmentRequestRequestType_FieldPathValue) 688 return res, ok 689 } 690 func (fpvs *PlanAssignmentRequest_FieldSubPathValue) AsStatusPathValue() (PlanAssignmentRequestStatus_FieldPathValue, bool) { 691 res, ok := fpvs.subPathValue.(PlanAssignmentRequestStatus_FieldPathValue) 692 return res, ok 693 } 694 func (fpvs *PlanAssignmentRequest_FieldSubPathValue) AsMetadataPathValue() (meta.Meta_FieldPathValue, bool) { 695 res, ok := fpvs.subPathValue.(meta.Meta_FieldPathValue) 696 return res, ok 697 } 698 699 func (fpvs *PlanAssignmentRequest_FieldSubPathValue) SetTo(target **PlanAssignmentRequest) { 700 if *target == nil { 701 *target = new(PlanAssignmentRequest) 702 } 703 switch fpvs.Selector() { 704 case PlanAssignmentRequest_FieldPathSelectorRequest: 705 fpvs.subPathValue.(PlanAssignmentRequestRequestType_FieldPathValue).SetTo(&(*target).Request) 706 case PlanAssignmentRequest_FieldPathSelectorStatus: 707 fpvs.subPathValue.(PlanAssignmentRequestStatus_FieldPathValue).SetTo(&(*target).Status) 708 case PlanAssignmentRequest_FieldPathSelectorMetadata: 709 fpvs.subPathValue.(meta.Meta_FieldPathValue).SetTo(&(*target).Metadata) 710 default: 711 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fpvs.Selector())) 712 } 713 } 714 715 func (fpvs *PlanAssignmentRequest_FieldSubPathValue) SetToRaw(target proto.Message) { 716 typedObject := target.(*PlanAssignmentRequest) 717 fpvs.SetTo(&typedObject) 718 } 719 720 func (fpvs *PlanAssignmentRequest_FieldSubPathValue) GetRawValue() interface{} { 721 return fpvs.subPathValue.GetRawValue() 722 } 723 724 func (fpvs *PlanAssignmentRequest_FieldSubPathValue) CompareWith(source *PlanAssignmentRequest) (int, bool) { 725 switch fpvs.Selector() { 726 case PlanAssignmentRequest_FieldPathSelectorRequest: 727 return fpvs.subPathValue.(PlanAssignmentRequestRequestType_FieldPathValue).CompareWith(source.GetRequest()) 728 case PlanAssignmentRequest_FieldPathSelectorStatus: 729 return fpvs.subPathValue.(PlanAssignmentRequestStatus_FieldPathValue).CompareWith(source.GetStatus()) 730 case PlanAssignmentRequest_FieldPathSelectorMetadata: 731 return fpvs.subPathValue.(meta.Meta_FieldPathValue).CompareWith(source.GetMetadata()) 732 default: 733 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fpvs.Selector())) 734 } 735 } 736 737 func (fpvs *PlanAssignmentRequest_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 738 return fpvs.CompareWith(source.(*PlanAssignmentRequest)) 739 } 740 741 // PlanAssignmentRequest_FieldPathArrayItemValue allows storing single item in Path-specific values for PlanAssignmentRequest according to their type 742 // Present only for array (repeated) types. 743 type PlanAssignmentRequest_FieldPathArrayItemValue interface { 744 gotenobject.FieldPathArrayItemValue 745 PlanAssignmentRequest_FieldPath 746 ContainsValue(*PlanAssignmentRequest) bool 747 } 748 749 // ParsePlanAssignmentRequest_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 750 func ParsePlanAssignmentRequest_FieldPathArrayItemValue(pathStr, valueStr string) (PlanAssignmentRequest_FieldPathArrayItemValue, error) { 751 fp, err := ParsePlanAssignmentRequest_FieldPath(pathStr) 752 if err != nil { 753 return nil, err 754 } 755 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 756 if err != nil { 757 return nil, status.Errorf(codes.InvalidArgument, "error parsing PlanAssignmentRequest field path array item value from %s: %v", valueStr, err) 758 } 759 return fpaiv.(PlanAssignmentRequest_FieldPathArrayItemValue), nil 760 } 761 762 func MustParsePlanAssignmentRequest_FieldPathArrayItemValue(pathStr, valueStr string) PlanAssignmentRequest_FieldPathArrayItemValue { 763 fpaiv, err := ParsePlanAssignmentRequest_FieldPathArrayItemValue(pathStr, valueStr) 764 if err != nil { 765 panic(err) 766 } 767 return fpaiv 768 } 769 770 type PlanAssignmentRequest_FieldTerminalPathArrayItemValue struct { 771 PlanAssignmentRequest_FieldTerminalPath 772 value interface{} 773 } 774 775 var _ PlanAssignmentRequest_FieldPathArrayItemValue = (*PlanAssignmentRequest_FieldTerminalPathArrayItemValue)(nil) 776 777 // GetRawValue returns stored element value for array in object PlanAssignmentRequest as interface{} 778 func (fpaiv *PlanAssignmentRequest_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 779 return fpaiv.value 780 } 781 782 func (fpaiv *PlanAssignmentRequest_FieldTerminalPathArrayItemValue) GetSingle(source *PlanAssignmentRequest) (interface{}, bool) { 783 return nil, false 784 } 785 786 func (fpaiv *PlanAssignmentRequest_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 787 return fpaiv.GetSingle(source.(*PlanAssignmentRequest)) 788 } 789 790 // Contains returns a boolean indicating if value that is being held is present in given 'PlanAssignmentRequest' 791 func (fpaiv *PlanAssignmentRequest_FieldTerminalPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest) bool { 792 slice := fpaiv.PlanAssignmentRequest_FieldTerminalPath.Get(source) 793 for _, v := range slice { 794 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 795 if proto.Equal(asProtoMsg, v.(proto.Message)) { 796 return true 797 } 798 } else if reflect.DeepEqual(v, fpaiv.value) { 799 return true 800 } 801 } 802 return false 803 } 804 805 type PlanAssignmentRequest_FieldSubPathArrayItemValue struct { 806 PlanAssignmentRequest_FieldPath 807 subPathItemValue gotenobject.FieldPathArrayItemValue 808 } 809 810 // GetRawValue returns stored array item value 811 func (fpaivs *PlanAssignmentRequest_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 812 return fpaivs.subPathItemValue.GetRawItemValue() 813 } 814 func (fpaivs *PlanAssignmentRequest_FieldSubPathArrayItemValue) AsRequestPathItemValue() (PlanAssignmentRequestRequestType_FieldPathArrayItemValue, bool) { 815 res, ok := fpaivs.subPathItemValue.(PlanAssignmentRequestRequestType_FieldPathArrayItemValue) 816 return res, ok 817 } 818 func (fpaivs *PlanAssignmentRequest_FieldSubPathArrayItemValue) AsStatusPathItemValue() (PlanAssignmentRequestStatus_FieldPathArrayItemValue, bool) { 819 res, ok := fpaivs.subPathItemValue.(PlanAssignmentRequestStatus_FieldPathArrayItemValue) 820 return res, ok 821 } 822 func (fpaivs *PlanAssignmentRequest_FieldSubPathArrayItemValue) AsMetadataPathItemValue() (meta.Meta_FieldPathArrayItemValue, bool) { 823 res, ok := fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue) 824 return res, ok 825 } 826 827 // Contains returns a boolean indicating if value that is being held is present in given 'PlanAssignmentRequest' 828 func (fpaivs *PlanAssignmentRequest_FieldSubPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest) bool { 829 switch fpaivs.Selector() { 830 case PlanAssignmentRequest_FieldPathSelectorRequest: 831 return fpaivs.subPathItemValue.(PlanAssignmentRequestRequestType_FieldPathArrayItemValue).ContainsValue(source.GetRequest()) 832 case PlanAssignmentRequest_FieldPathSelectorStatus: 833 return fpaivs.subPathItemValue.(PlanAssignmentRequestStatus_FieldPathArrayItemValue).ContainsValue(source.GetStatus()) 834 case PlanAssignmentRequest_FieldPathSelectorMetadata: 835 return fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue).ContainsValue(source.GetMetadata()) 836 default: 837 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest: %d", fpaivs.Selector())) 838 } 839 } 840 841 // PlanAssignmentRequest_FieldPathArrayOfValues allows storing slice of values for PlanAssignmentRequest fields according to their type 842 type PlanAssignmentRequest_FieldPathArrayOfValues interface { 843 gotenobject.FieldPathArrayOfValues 844 PlanAssignmentRequest_FieldPath 845 } 846 847 func ParsePlanAssignmentRequest_FieldPathArrayOfValues(pathStr, valuesStr string) (PlanAssignmentRequest_FieldPathArrayOfValues, error) { 848 fp, err := ParsePlanAssignmentRequest_FieldPath(pathStr) 849 if err != nil { 850 return nil, err 851 } 852 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 853 if err != nil { 854 return nil, status.Errorf(codes.InvalidArgument, "error parsing PlanAssignmentRequest field path array of values from %s: %v", valuesStr, err) 855 } 856 return fpaov.(PlanAssignmentRequest_FieldPathArrayOfValues), nil 857 } 858 859 func MustParsePlanAssignmentRequest_FieldPathArrayOfValues(pathStr, valuesStr string) PlanAssignmentRequest_FieldPathArrayOfValues { 860 fpaov, err := ParsePlanAssignmentRequest_FieldPathArrayOfValues(pathStr, valuesStr) 861 if err != nil { 862 panic(err) 863 } 864 return fpaov 865 } 866 867 type PlanAssignmentRequest_FieldTerminalPathArrayOfValues struct { 868 PlanAssignmentRequest_FieldTerminalPath 869 values interface{} 870 } 871 872 var _ PlanAssignmentRequest_FieldPathArrayOfValues = (*PlanAssignmentRequest_FieldTerminalPathArrayOfValues)(nil) 873 874 func (fpaov *PlanAssignmentRequest_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 875 switch fpaov.selector { 876 case PlanAssignmentRequest_FieldPathSelectorName: 877 for _, v := range fpaov.values.([]*Name) { 878 values = append(values, v) 879 } 880 case PlanAssignmentRequest_FieldPathSelectorRequest: 881 for _, v := range fpaov.values.([]*PlanAssignmentRequest_RequestType) { 882 values = append(values, v) 883 } 884 case PlanAssignmentRequest_FieldPathSelectorService: 885 for _, v := range fpaov.values.([]*meta_service.Reference) { 886 values = append(values, v) 887 } 888 case PlanAssignmentRequest_FieldPathSelectorApprover: 889 for _, v := range fpaov.values.([]*iam_organization.Reference) { 890 values = append(values, v) 891 } 892 case PlanAssignmentRequest_FieldPathSelectorStatus: 893 for _, v := range fpaov.values.([]*PlanAssignmentRequest_Status) { 894 values = append(values, v) 895 } 896 case PlanAssignmentRequest_FieldPathSelectorMetadata: 897 for _, v := range fpaov.values.([]*meta.Meta) { 898 values = append(values, v) 899 } 900 } 901 return 902 } 903 func (fpaov *PlanAssignmentRequest_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) { 904 res, ok := fpaov.values.([]*Name) 905 return res, ok 906 } 907 func (fpaov *PlanAssignmentRequest_FieldTerminalPathArrayOfValues) AsRequestArrayOfValues() ([]*PlanAssignmentRequest_RequestType, bool) { 908 res, ok := fpaov.values.([]*PlanAssignmentRequest_RequestType) 909 return res, ok 910 } 911 func (fpaov *PlanAssignmentRequest_FieldTerminalPathArrayOfValues) AsServiceArrayOfValues() ([]*meta_service.Reference, bool) { 912 res, ok := fpaov.values.([]*meta_service.Reference) 913 return res, ok 914 } 915 func (fpaov *PlanAssignmentRequest_FieldTerminalPathArrayOfValues) AsApproverArrayOfValues() ([]*iam_organization.Reference, bool) { 916 res, ok := fpaov.values.([]*iam_organization.Reference) 917 return res, ok 918 } 919 func (fpaov *PlanAssignmentRequest_FieldTerminalPathArrayOfValues) AsStatusArrayOfValues() ([]*PlanAssignmentRequest_Status, bool) { 920 res, ok := fpaov.values.([]*PlanAssignmentRequest_Status) 921 return res, ok 922 } 923 func (fpaov *PlanAssignmentRequest_FieldTerminalPathArrayOfValues) AsMetadataArrayOfValues() ([]*meta.Meta, bool) { 924 res, ok := fpaov.values.([]*meta.Meta) 925 return res, ok 926 } 927 928 type PlanAssignmentRequest_FieldSubPathArrayOfValues struct { 929 PlanAssignmentRequest_FieldPath 930 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 931 } 932 933 var _ PlanAssignmentRequest_FieldPathArrayOfValues = (*PlanAssignmentRequest_FieldSubPathArrayOfValues)(nil) 934 935 func (fpsaov *PlanAssignmentRequest_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 936 return fpsaov.subPathArrayOfValues.GetRawValues() 937 } 938 func (fpsaov *PlanAssignmentRequest_FieldSubPathArrayOfValues) AsRequestPathArrayOfValues() (PlanAssignmentRequestRequestType_FieldPathArrayOfValues, bool) { 939 res, ok := fpsaov.subPathArrayOfValues.(PlanAssignmentRequestRequestType_FieldPathArrayOfValues) 940 return res, ok 941 } 942 func (fpsaov *PlanAssignmentRequest_FieldSubPathArrayOfValues) AsStatusPathArrayOfValues() (PlanAssignmentRequestStatus_FieldPathArrayOfValues, bool) { 943 res, ok := fpsaov.subPathArrayOfValues.(PlanAssignmentRequestStatus_FieldPathArrayOfValues) 944 return res, ok 945 } 946 func (fpsaov *PlanAssignmentRequest_FieldSubPathArrayOfValues) AsMetadataPathArrayOfValues() (meta.Meta_FieldPathArrayOfValues, bool) { 947 res, ok := fpsaov.subPathArrayOfValues.(meta.Meta_FieldPathArrayOfValues) 948 return res, ok 949 } 950 951 // FieldPath provides implementation to handle 952 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 953 type PlanAssignmentRequestStatus_FieldPath interface { 954 gotenobject.FieldPath 955 Selector() PlanAssignmentRequestStatus_FieldPathSelector 956 Get(source *PlanAssignmentRequest_Status) []interface{} 957 GetSingle(source *PlanAssignmentRequest_Status) (interface{}, bool) 958 ClearValue(item *PlanAssignmentRequest_Status) 959 960 // Those methods build corresponding PlanAssignmentRequestStatus_FieldPathValue 961 // (or array of values) and holds passed value. Panics if injected type is incorrect. 962 WithIValue(value interface{}) PlanAssignmentRequestStatus_FieldPathValue 963 WithIArrayOfValues(values interface{}) PlanAssignmentRequestStatus_FieldPathArrayOfValues 964 WithIArrayItemValue(value interface{}) PlanAssignmentRequestStatus_FieldPathArrayItemValue 965 } 966 967 type PlanAssignmentRequestStatus_FieldPathSelector int32 968 969 const ( 970 PlanAssignmentRequestStatus_FieldPathSelectorConclusion PlanAssignmentRequestStatus_FieldPathSelector = 0 971 PlanAssignmentRequestStatus_FieldPathSelectorReason PlanAssignmentRequestStatus_FieldPathSelector = 1 972 ) 973 974 func (s PlanAssignmentRequestStatus_FieldPathSelector) String() string { 975 switch s { 976 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 977 return "conclusion" 978 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 979 return "reason" 980 default: 981 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", s)) 982 } 983 } 984 985 func BuildPlanAssignmentRequestStatus_FieldPath(fp gotenobject.RawFieldPath) (PlanAssignmentRequestStatus_FieldPath, error) { 986 if len(fp) == 0 { 987 return nil, status.Error(codes.InvalidArgument, "empty field path for object PlanAssignmentRequest_Status") 988 } 989 if len(fp) == 1 { 990 switch fp[0] { 991 case "conclusion": 992 return &PlanAssignmentRequestStatus_FieldTerminalPath{selector: PlanAssignmentRequestStatus_FieldPathSelectorConclusion}, nil 993 case "reason": 994 return &PlanAssignmentRequestStatus_FieldTerminalPath{selector: PlanAssignmentRequestStatus_FieldPathSelectorReason}, nil 995 } 996 } 997 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PlanAssignmentRequest_Status", fp) 998 } 999 1000 func ParsePlanAssignmentRequestStatus_FieldPath(rawField string) (PlanAssignmentRequestStatus_FieldPath, error) { 1001 fp, err := gotenobject.ParseRawFieldPath(rawField) 1002 if err != nil { 1003 return nil, err 1004 } 1005 return BuildPlanAssignmentRequestStatus_FieldPath(fp) 1006 } 1007 1008 func MustParsePlanAssignmentRequestStatus_FieldPath(rawField string) PlanAssignmentRequestStatus_FieldPath { 1009 fp, err := ParsePlanAssignmentRequestStatus_FieldPath(rawField) 1010 if err != nil { 1011 panic(err) 1012 } 1013 return fp 1014 } 1015 1016 type PlanAssignmentRequestStatus_FieldTerminalPath struct { 1017 selector PlanAssignmentRequestStatus_FieldPathSelector 1018 } 1019 1020 var _ PlanAssignmentRequestStatus_FieldPath = (*PlanAssignmentRequestStatus_FieldTerminalPath)(nil) 1021 1022 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) Selector() PlanAssignmentRequestStatus_FieldPathSelector { 1023 return fp.selector 1024 } 1025 1026 // String returns path representation in proto convention 1027 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) String() string { 1028 return fp.selector.String() 1029 } 1030 1031 // JSONString returns path representation is JSON convention 1032 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) JSONString() string { 1033 return strcase.ToLowerCamel(fp.String()) 1034 } 1035 1036 // Get returns all values pointed by specific field from source PlanAssignmentRequest_Status 1037 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) Get(source *PlanAssignmentRequest_Status) (values []interface{}) { 1038 if source != nil { 1039 switch fp.selector { 1040 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 1041 values = append(values, source.Conclusion) 1042 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 1043 values = append(values, source.Reason) 1044 default: 1045 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", fp.selector)) 1046 } 1047 } 1048 return 1049 } 1050 1051 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1052 return fp.Get(source.(*PlanAssignmentRequest_Status)) 1053 } 1054 1055 // GetSingle returns value pointed by specific field of from source PlanAssignmentRequest_Status 1056 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) GetSingle(source *PlanAssignmentRequest_Status) (interface{}, bool) { 1057 switch fp.selector { 1058 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 1059 return source.GetConclusion(), source != nil 1060 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 1061 return source.GetReason(), source != nil 1062 default: 1063 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", fp.selector)) 1064 } 1065 } 1066 1067 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1068 return fp.GetSingle(source.(*PlanAssignmentRequest_Status)) 1069 } 1070 1071 // GetDefault returns a default value of the field type 1072 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) GetDefault() interface{} { 1073 switch fp.selector { 1074 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 1075 return PlanAssignmentRequest_Status_UNDEFINED 1076 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 1077 return "" 1078 default: 1079 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", fp.selector)) 1080 } 1081 } 1082 1083 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) ClearValue(item *PlanAssignmentRequest_Status) { 1084 if item != nil { 1085 switch fp.selector { 1086 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 1087 item.Conclusion = PlanAssignmentRequest_Status_UNDEFINED 1088 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 1089 item.Reason = "" 1090 default: 1091 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", fp.selector)) 1092 } 1093 } 1094 } 1095 1096 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1097 fp.ClearValue(item.(*PlanAssignmentRequest_Status)) 1098 } 1099 1100 // IsLeaf - whether field path is holds simple value 1101 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) IsLeaf() bool { 1102 return fp.selector == PlanAssignmentRequestStatus_FieldPathSelectorConclusion || 1103 fp.selector == PlanAssignmentRequestStatus_FieldPathSelectorReason 1104 } 1105 1106 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1107 return []gotenobject.FieldPath{fp} 1108 } 1109 1110 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) WithIValue(value interface{}) PlanAssignmentRequestStatus_FieldPathValue { 1111 switch fp.selector { 1112 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 1113 return &PlanAssignmentRequestStatus_FieldTerminalPathValue{PlanAssignmentRequestStatus_FieldTerminalPath: *fp, value: value.(PlanAssignmentRequest_Status_Conclusion)} 1114 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 1115 return &PlanAssignmentRequestStatus_FieldTerminalPathValue{PlanAssignmentRequestStatus_FieldTerminalPath: *fp, value: value.(string)} 1116 default: 1117 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", fp.selector)) 1118 } 1119 } 1120 1121 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1122 return fp.WithIValue(value) 1123 } 1124 1125 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestStatus_FieldPathArrayOfValues { 1126 fpaov := &PlanAssignmentRequestStatus_FieldTerminalPathArrayOfValues{PlanAssignmentRequestStatus_FieldTerminalPath: *fp} 1127 switch fp.selector { 1128 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 1129 return &PlanAssignmentRequestStatus_FieldTerminalPathArrayOfValues{PlanAssignmentRequestStatus_FieldTerminalPath: *fp, values: values.([]PlanAssignmentRequest_Status_Conclusion)} 1130 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 1131 return &PlanAssignmentRequestStatus_FieldTerminalPathArrayOfValues{PlanAssignmentRequestStatus_FieldTerminalPath: *fp, values: values.([]string)} 1132 default: 1133 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", fp.selector)) 1134 } 1135 return fpaov 1136 } 1137 1138 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1139 return fp.WithIArrayOfValues(values) 1140 } 1141 1142 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestStatus_FieldPathArrayItemValue { 1143 switch fp.selector { 1144 default: 1145 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", fp.selector)) 1146 } 1147 } 1148 1149 func (fp *PlanAssignmentRequestStatus_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1150 return fp.WithIArrayItemValue(value) 1151 } 1152 1153 // PlanAssignmentRequestStatus_FieldPathValue allows storing values for Status fields according to their type 1154 type PlanAssignmentRequestStatus_FieldPathValue interface { 1155 PlanAssignmentRequestStatus_FieldPath 1156 gotenobject.FieldPathValue 1157 SetTo(target **PlanAssignmentRequest_Status) 1158 CompareWith(*PlanAssignmentRequest_Status) (cmp int, comparable bool) 1159 } 1160 1161 func ParsePlanAssignmentRequestStatus_FieldPathValue(pathStr, valueStr string) (PlanAssignmentRequestStatus_FieldPathValue, error) { 1162 fp, err := ParsePlanAssignmentRequestStatus_FieldPath(pathStr) 1163 if err != nil { 1164 return nil, err 1165 } 1166 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1167 if err != nil { 1168 return nil, status.Errorf(codes.InvalidArgument, "error parsing Status field path value from %s: %v", valueStr, err) 1169 } 1170 return fpv.(PlanAssignmentRequestStatus_FieldPathValue), nil 1171 } 1172 1173 func MustParsePlanAssignmentRequestStatus_FieldPathValue(pathStr, valueStr string) PlanAssignmentRequestStatus_FieldPathValue { 1174 fpv, err := ParsePlanAssignmentRequestStatus_FieldPathValue(pathStr, valueStr) 1175 if err != nil { 1176 panic(err) 1177 } 1178 return fpv 1179 } 1180 1181 type PlanAssignmentRequestStatus_FieldTerminalPathValue struct { 1182 PlanAssignmentRequestStatus_FieldTerminalPath 1183 value interface{} 1184 } 1185 1186 var _ PlanAssignmentRequestStatus_FieldPathValue = (*PlanAssignmentRequestStatus_FieldTerminalPathValue)(nil) 1187 1188 // GetRawValue returns raw value stored under selected path for 'Status' as interface{} 1189 func (fpv *PlanAssignmentRequestStatus_FieldTerminalPathValue) GetRawValue() interface{} { 1190 return fpv.value 1191 } 1192 func (fpv *PlanAssignmentRequestStatus_FieldTerminalPathValue) AsConclusionValue() (PlanAssignmentRequest_Status_Conclusion, bool) { 1193 res, ok := fpv.value.(PlanAssignmentRequest_Status_Conclusion) 1194 return res, ok 1195 } 1196 func (fpv *PlanAssignmentRequestStatus_FieldTerminalPathValue) AsReasonValue() (string, bool) { 1197 res, ok := fpv.value.(string) 1198 return res, ok 1199 } 1200 1201 // SetTo stores value for selected field for object Status 1202 func (fpv *PlanAssignmentRequestStatus_FieldTerminalPathValue) SetTo(target **PlanAssignmentRequest_Status) { 1203 if *target == nil { 1204 *target = new(PlanAssignmentRequest_Status) 1205 } 1206 switch fpv.selector { 1207 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 1208 (*target).Conclusion = fpv.value.(PlanAssignmentRequest_Status_Conclusion) 1209 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 1210 (*target).Reason = fpv.value.(string) 1211 default: 1212 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", fpv.selector)) 1213 } 1214 } 1215 1216 func (fpv *PlanAssignmentRequestStatus_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1217 typedObject := target.(*PlanAssignmentRequest_Status) 1218 fpv.SetTo(&typedObject) 1219 } 1220 1221 // CompareWith compares value in the 'PlanAssignmentRequestStatus_FieldTerminalPathValue' with the value under path in 'PlanAssignmentRequest_Status'. 1222 func (fpv *PlanAssignmentRequestStatus_FieldTerminalPathValue) CompareWith(source *PlanAssignmentRequest_Status) (int, bool) { 1223 switch fpv.selector { 1224 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 1225 leftValue := fpv.value.(PlanAssignmentRequest_Status_Conclusion) 1226 rightValue := source.GetConclusion() 1227 if (leftValue) == (rightValue) { 1228 return 0, true 1229 } else if (leftValue) < (rightValue) { 1230 return -1, true 1231 } else { 1232 return 1, true 1233 } 1234 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 1235 leftValue := fpv.value.(string) 1236 rightValue := source.GetReason() 1237 if (leftValue) == (rightValue) { 1238 return 0, true 1239 } else if (leftValue) < (rightValue) { 1240 return -1, true 1241 } else { 1242 return 1, true 1243 } 1244 default: 1245 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_Status: %d", fpv.selector)) 1246 } 1247 } 1248 1249 func (fpv *PlanAssignmentRequestStatus_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1250 return fpv.CompareWith(source.(*PlanAssignmentRequest_Status)) 1251 } 1252 1253 // PlanAssignmentRequestStatus_FieldPathArrayItemValue allows storing single item in Path-specific values for Status according to their type 1254 // Present only for array (repeated) types. 1255 type PlanAssignmentRequestStatus_FieldPathArrayItemValue interface { 1256 gotenobject.FieldPathArrayItemValue 1257 PlanAssignmentRequestStatus_FieldPath 1258 ContainsValue(*PlanAssignmentRequest_Status) bool 1259 } 1260 1261 // ParsePlanAssignmentRequestStatus_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1262 func ParsePlanAssignmentRequestStatus_FieldPathArrayItemValue(pathStr, valueStr string) (PlanAssignmentRequestStatus_FieldPathArrayItemValue, error) { 1263 fp, err := ParsePlanAssignmentRequestStatus_FieldPath(pathStr) 1264 if err != nil { 1265 return nil, err 1266 } 1267 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1268 if err != nil { 1269 return nil, status.Errorf(codes.InvalidArgument, "error parsing Status field path array item value from %s: %v", valueStr, err) 1270 } 1271 return fpaiv.(PlanAssignmentRequestStatus_FieldPathArrayItemValue), nil 1272 } 1273 1274 func MustParsePlanAssignmentRequestStatus_FieldPathArrayItemValue(pathStr, valueStr string) PlanAssignmentRequestStatus_FieldPathArrayItemValue { 1275 fpaiv, err := ParsePlanAssignmentRequestStatus_FieldPathArrayItemValue(pathStr, valueStr) 1276 if err != nil { 1277 panic(err) 1278 } 1279 return fpaiv 1280 } 1281 1282 type PlanAssignmentRequestStatus_FieldTerminalPathArrayItemValue struct { 1283 PlanAssignmentRequestStatus_FieldTerminalPath 1284 value interface{} 1285 } 1286 1287 var _ PlanAssignmentRequestStatus_FieldPathArrayItemValue = (*PlanAssignmentRequestStatus_FieldTerminalPathArrayItemValue)(nil) 1288 1289 // GetRawValue returns stored element value for array in object PlanAssignmentRequest_Status as interface{} 1290 func (fpaiv *PlanAssignmentRequestStatus_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1291 return fpaiv.value 1292 } 1293 1294 func (fpaiv *PlanAssignmentRequestStatus_FieldTerminalPathArrayItemValue) GetSingle(source *PlanAssignmentRequest_Status) (interface{}, bool) { 1295 return nil, false 1296 } 1297 1298 func (fpaiv *PlanAssignmentRequestStatus_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1299 return fpaiv.GetSingle(source.(*PlanAssignmentRequest_Status)) 1300 } 1301 1302 // Contains returns a boolean indicating if value that is being held is present in given 'Status' 1303 func (fpaiv *PlanAssignmentRequestStatus_FieldTerminalPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_Status) bool { 1304 slice := fpaiv.PlanAssignmentRequestStatus_FieldTerminalPath.Get(source) 1305 for _, v := range slice { 1306 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1307 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1308 return true 1309 } 1310 } else if reflect.DeepEqual(v, fpaiv.value) { 1311 return true 1312 } 1313 } 1314 return false 1315 } 1316 1317 // PlanAssignmentRequestStatus_FieldPathArrayOfValues allows storing slice of values for Status fields according to their type 1318 type PlanAssignmentRequestStatus_FieldPathArrayOfValues interface { 1319 gotenobject.FieldPathArrayOfValues 1320 PlanAssignmentRequestStatus_FieldPath 1321 } 1322 1323 func ParsePlanAssignmentRequestStatus_FieldPathArrayOfValues(pathStr, valuesStr string) (PlanAssignmentRequestStatus_FieldPathArrayOfValues, error) { 1324 fp, err := ParsePlanAssignmentRequestStatus_FieldPath(pathStr) 1325 if err != nil { 1326 return nil, err 1327 } 1328 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1329 if err != nil { 1330 return nil, status.Errorf(codes.InvalidArgument, "error parsing Status field path array of values from %s: %v", valuesStr, err) 1331 } 1332 return fpaov.(PlanAssignmentRequestStatus_FieldPathArrayOfValues), nil 1333 } 1334 1335 func MustParsePlanAssignmentRequestStatus_FieldPathArrayOfValues(pathStr, valuesStr string) PlanAssignmentRequestStatus_FieldPathArrayOfValues { 1336 fpaov, err := ParsePlanAssignmentRequestStatus_FieldPathArrayOfValues(pathStr, valuesStr) 1337 if err != nil { 1338 panic(err) 1339 } 1340 return fpaov 1341 } 1342 1343 type PlanAssignmentRequestStatus_FieldTerminalPathArrayOfValues struct { 1344 PlanAssignmentRequestStatus_FieldTerminalPath 1345 values interface{} 1346 } 1347 1348 var _ PlanAssignmentRequestStatus_FieldPathArrayOfValues = (*PlanAssignmentRequestStatus_FieldTerminalPathArrayOfValues)(nil) 1349 1350 func (fpaov *PlanAssignmentRequestStatus_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1351 switch fpaov.selector { 1352 case PlanAssignmentRequestStatus_FieldPathSelectorConclusion: 1353 for _, v := range fpaov.values.([]PlanAssignmentRequest_Status_Conclusion) { 1354 values = append(values, v) 1355 } 1356 case PlanAssignmentRequestStatus_FieldPathSelectorReason: 1357 for _, v := range fpaov.values.([]string) { 1358 values = append(values, v) 1359 } 1360 } 1361 return 1362 } 1363 func (fpaov *PlanAssignmentRequestStatus_FieldTerminalPathArrayOfValues) AsConclusionArrayOfValues() ([]PlanAssignmentRequest_Status_Conclusion, bool) { 1364 res, ok := fpaov.values.([]PlanAssignmentRequest_Status_Conclusion) 1365 return res, ok 1366 } 1367 func (fpaov *PlanAssignmentRequestStatus_FieldTerminalPathArrayOfValues) AsReasonArrayOfValues() ([]string, bool) { 1368 res, ok := fpaov.values.([]string) 1369 return res, ok 1370 } 1371 1372 // FieldPath provides implementation to handle 1373 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1374 type PlanAssignmentRequestRequestType_FieldPath interface { 1375 gotenobject.FieldPath 1376 Selector() PlanAssignmentRequestRequestType_FieldPathSelector 1377 Get(source *PlanAssignmentRequest_RequestType) []interface{} 1378 GetSingle(source *PlanAssignmentRequest_RequestType) (interface{}, bool) 1379 ClearValue(item *PlanAssignmentRequest_RequestType) 1380 1381 // Those methods build corresponding PlanAssignmentRequestRequestType_FieldPathValue 1382 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1383 WithIValue(value interface{}) PlanAssignmentRequestRequestType_FieldPathValue 1384 WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestType_FieldPathArrayOfValues 1385 WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestType_FieldPathArrayItemValue 1386 } 1387 1388 type PlanAssignmentRequestRequestType_FieldPathSelector int32 1389 1390 const ( 1391 PlanAssignmentRequestRequestType_FieldPathSelectorAssign PlanAssignmentRequestRequestType_FieldPathSelector = 0 1392 PlanAssignmentRequestRequestType_FieldPathSelectorExtend PlanAssignmentRequestRequestType_FieldPathSelector = 1 1393 PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute PlanAssignmentRequestRequestType_FieldPathSelector = 2 1394 PlanAssignmentRequestRequestType_FieldPathSelectorUnassign PlanAssignmentRequestRequestType_FieldPathSelector = 3 1395 ) 1396 1397 func (s PlanAssignmentRequestRequestType_FieldPathSelector) String() string { 1398 switch s { 1399 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1400 return "assign" 1401 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1402 return "extend" 1403 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1404 return "redistribute" 1405 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1406 return "unassign" 1407 default: 1408 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", s)) 1409 } 1410 } 1411 1412 func BuildPlanAssignmentRequestRequestType_FieldPath(fp gotenobject.RawFieldPath) (PlanAssignmentRequestRequestType_FieldPath, error) { 1413 if len(fp) == 0 { 1414 return nil, status.Error(codes.InvalidArgument, "empty field path for object PlanAssignmentRequest_RequestType") 1415 } 1416 if len(fp) == 1 { 1417 switch fp[0] { 1418 case "assign": 1419 return &PlanAssignmentRequestRequestType_FieldTerminalPath{selector: PlanAssignmentRequestRequestType_FieldPathSelectorAssign}, nil 1420 case "extend": 1421 return &PlanAssignmentRequestRequestType_FieldTerminalPath{selector: PlanAssignmentRequestRequestType_FieldPathSelectorExtend}, nil 1422 case "redistribute": 1423 return &PlanAssignmentRequestRequestType_FieldTerminalPath{selector: PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute}, nil 1424 case "unassign": 1425 return &PlanAssignmentRequestRequestType_FieldTerminalPath{selector: PlanAssignmentRequestRequestType_FieldPathSelectorUnassign}, nil 1426 } 1427 } else { 1428 switch fp[0] { 1429 case "assign": 1430 if subpath, err := BuildPlanAssignmentRequestRequestTypeAssign_FieldPath(fp[1:]); err != nil { 1431 return nil, err 1432 } else { 1433 return &PlanAssignmentRequestRequestType_FieldSubPath{selector: PlanAssignmentRequestRequestType_FieldPathSelectorAssign, subPath: subpath}, nil 1434 } 1435 case "extend": 1436 if subpath, err := BuildPlanAssignmentRequestRequestTypeExtend_FieldPath(fp[1:]); err != nil { 1437 return nil, err 1438 } else { 1439 return &PlanAssignmentRequestRequestType_FieldSubPath{selector: PlanAssignmentRequestRequestType_FieldPathSelectorExtend, subPath: subpath}, nil 1440 } 1441 case "redistribute": 1442 if subpath, err := BuildPlanAssignmentRequestRequestTypeRedistribute_FieldPath(fp[1:]); err != nil { 1443 return nil, err 1444 } else { 1445 return &PlanAssignmentRequestRequestType_FieldSubPath{selector: PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute, subPath: subpath}, nil 1446 } 1447 case "unassign": 1448 if subpath, err := BuildPlanAssignmentRequestRequestTypeUnassign_FieldPath(fp[1:]); err != nil { 1449 return nil, err 1450 } else { 1451 return &PlanAssignmentRequestRequestType_FieldSubPath{selector: PlanAssignmentRequestRequestType_FieldPathSelectorUnassign, subPath: subpath}, nil 1452 } 1453 } 1454 } 1455 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PlanAssignmentRequest_RequestType", fp) 1456 } 1457 1458 func ParsePlanAssignmentRequestRequestType_FieldPath(rawField string) (PlanAssignmentRequestRequestType_FieldPath, error) { 1459 fp, err := gotenobject.ParseRawFieldPath(rawField) 1460 if err != nil { 1461 return nil, err 1462 } 1463 return BuildPlanAssignmentRequestRequestType_FieldPath(fp) 1464 } 1465 1466 func MustParsePlanAssignmentRequestRequestType_FieldPath(rawField string) PlanAssignmentRequestRequestType_FieldPath { 1467 fp, err := ParsePlanAssignmentRequestRequestType_FieldPath(rawField) 1468 if err != nil { 1469 panic(err) 1470 } 1471 return fp 1472 } 1473 1474 type PlanAssignmentRequestRequestType_FieldTerminalPath struct { 1475 selector PlanAssignmentRequestRequestType_FieldPathSelector 1476 } 1477 1478 var _ PlanAssignmentRequestRequestType_FieldPath = (*PlanAssignmentRequestRequestType_FieldTerminalPath)(nil) 1479 1480 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) Selector() PlanAssignmentRequestRequestType_FieldPathSelector { 1481 return fp.selector 1482 } 1483 1484 // String returns path representation in proto convention 1485 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) String() string { 1486 return fp.selector.String() 1487 } 1488 1489 // JSONString returns path representation is JSON convention 1490 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) JSONString() string { 1491 return strcase.ToLowerCamel(fp.String()) 1492 } 1493 1494 // Get returns all values pointed by specific field from source PlanAssignmentRequest_RequestType 1495 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) Get(source *PlanAssignmentRequest_RequestType) (values []interface{}) { 1496 if source != nil { 1497 switch fp.selector { 1498 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1499 if source, ok := source.Request.(*PlanAssignmentRequest_RequestType_Assign_); ok && source != nil { 1500 if source.Assign != nil { 1501 values = append(values, source.Assign) 1502 } 1503 } 1504 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1505 if source, ok := source.Request.(*PlanAssignmentRequest_RequestType_Extend_); ok && source != nil { 1506 if source.Extend != nil { 1507 values = append(values, source.Extend) 1508 } 1509 } 1510 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1511 if source, ok := source.Request.(*PlanAssignmentRequest_RequestType_Redistribute_); ok && source != nil { 1512 if source.Redistribute != nil { 1513 values = append(values, source.Redistribute) 1514 } 1515 } 1516 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1517 if source, ok := source.Request.(*PlanAssignmentRequest_RequestType_Unassign_); ok && source != nil { 1518 if source.Unassign != nil { 1519 values = append(values, source.Unassign) 1520 } 1521 } 1522 default: 1523 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fp.selector)) 1524 } 1525 } 1526 return 1527 } 1528 1529 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1530 return fp.Get(source.(*PlanAssignmentRequest_RequestType)) 1531 } 1532 1533 // GetSingle returns value pointed by specific field of from source PlanAssignmentRequest_RequestType 1534 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) GetSingle(source *PlanAssignmentRequest_RequestType) (interface{}, bool) { 1535 switch fp.selector { 1536 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1537 // if object nil or oneof not active, return "default" type with false flag. 1538 if source == nil { 1539 return source.GetAssign(), false 1540 } 1541 _, oneOfSelected := source.Request.(*PlanAssignmentRequest_RequestType_Assign_) 1542 if !oneOfSelected { 1543 return source.GetAssign(), false // to return "type" information 1544 } 1545 res := source.GetAssign() 1546 return res, res != nil 1547 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1548 // if object nil or oneof not active, return "default" type with false flag. 1549 if source == nil { 1550 return source.GetExtend(), false 1551 } 1552 _, oneOfSelected := source.Request.(*PlanAssignmentRequest_RequestType_Extend_) 1553 if !oneOfSelected { 1554 return source.GetExtend(), false // to return "type" information 1555 } 1556 res := source.GetExtend() 1557 return res, res != nil 1558 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1559 // if object nil or oneof not active, return "default" type with false flag. 1560 if source == nil { 1561 return source.GetRedistribute(), false 1562 } 1563 _, oneOfSelected := source.Request.(*PlanAssignmentRequest_RequestType_Redistribute_) 1564 if !oneOfSelected { 1565 return source.GetRedistribute(), false // to return "type" information 1566 } 1567 res := source.GetRedistribute() 1568 return res, res != nil 1569 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1570 // if object nil or oneof not active, return "default" type with false flag. 1571 if source == nil { 1572 return source.GetUnassign(), false 1573 } 1574 _, oneOfSelected := source.Request.(*PlanAssignmentRequest_RequestType_Unassign_) 1575 if !oneOfSelected { 1576 return source.GetUnassign(), false // to return "type" information 1577 } 1578 res := source.GetUnassign() 1579 return res, res != nil 1580 default: 1581 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fp.selector)) 1582 } 1583 } 1584 1585 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1586 return fp.GetSingle(source.(*PlanAssignmentRequest_RequestType)) 1587 } 1588 1589 // GetDefault returns a default value of the field type 1590 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) GetDefault() interface{} { 1591 switch fp.selector { 1592 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1593 return (*PlanAssignmentRequest_RequestType_Assign)(nil) 1594 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1595 return (*PlanAssignmentRequest_RequestType_Extend)(nil) 1596 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1597 return (*PlanAssignmentRequest_RequestType_Redistribute)(nil) 1598 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1599 return (*PlanAssignmentRequest_RequestType_Unassign)(nil) 1600 default: 1601 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fp.selector)) 1602 } 1603 } 1604 1605 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) ClearValue(item *PlanAssignmentRequest_RequestType) { 1606 if item != nil { 1607 switch fp.selector { 1608 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1609 if item, ok := item.Request.(*PlanAssignmentRequest_RequestType_Assign_); ok { 1610 item.Assign = nil 1611 } 1612 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1613 if item, ok := item.Request.(*PlanAssignmentRequest_RequestType_Extend_); ok { 1614 item.Extend = nil 1615 } 1616 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1617 if item, ok := item.Request.(*PlanAssignmentRequest_RequestType_Redistribute_); ok { 1618 item.Redistribute = nil 1619 } 1620 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1621 if item, ok := item.Request.(*PlanAssignmentRequest_RequestType_Unassign_); ok { 1622 item.Unassign = nil 1623 } 1624 default: 1625 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fp.selector)) 1626 } 1627 } 1628 } 1629 1630 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1631 fp.ClearValue(item.(*PlanAssignmentRequest_RequestType)) 1632 } 1633 1634 // IsLeaf - whether field path is holds simple value 1635 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) IsLeaf() bool { 1636 return false 1637 } 1638 1639 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1640 return []gotenobject.FieldPath{fp} 1641 } 1642 1643 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) WithIValue(value interface{}) PlanAssignmentRequestRequestType_FieldPathValue { 1644 switch fp.selector { 1645 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1646 return &PlanAssignmentRequestRequestType_FieldTerminalPathValue{PlanAssignmentRequestRequestType_FieldTerminalPath: *fp, value: value.(*PlanAssignmentRequest_RequestType_Assign)} 1647 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1648 return &PlanAssignmentRequestRequestType_FieldTerminalPathValue{PlanAssignmentRequestRequestType_FieldTerminalPath: *fp, value: value.(*PlanAssignmentRequest_RequestType_Extend)} 1649 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1650 return &PlanAssignmentRequestRequestType_FieldTerminalPathValue{PlanAssignmentRequestRequestType_FieldTerminalPath: *fp, value: value.(*PlanAssignmentRequest_RequestType_Redistribute)} 1651 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1652 return &PlanAssignmentRequestRequestType_FieldTerminalPathValue{PlanAssignmentRequestRequestType_FieldTerminalPath: *fp, value: value.(*PlanAssignmentRequest_RequestType_Unassign)} 1653 default: 1654 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fp.selector)) 1655 } 1656 } 1657 1658 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1659 return fp.WithIValue(value) 1660 } 1661 1662 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestType_FieldPathArrayOfValues { 1663 fpaov := &PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestType_FieldTerminalPath: *fp} 1664 switch fp.selector { 1665 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1666 return &PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestType_FieldTerminalPath: *fp, values: values.([]*PlanAssignmentRequest_RequestType_Assign)} 1667 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1668 return &PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestType_FieldTerminalPath: *fp, values: values.([]*PlanAssignmentRequest_RequestType_Extend)} 1669 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1670 return &PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestType_FieldTerminalPath: *fp, values: values.([]*PlanAssignmentRequest_RequestType_Redistribute)} 1671 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1672 return &PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestType_FieldTerminalPath: *fp, values: values.([]*PlanAssignmentRequest_RequestType_Unassign)} 1673 default: 1674 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fp.selector)) 1675 } 1676 return fpaov 1677 } 1678 1679 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1680 return fp.WithIArrayOfValues(values) 1681 } 1682 1683 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestType_FieldPathArrayItemValue { 1684 switch fp.selector { 1685 default: 1686 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fp.selector)) 1687 } 1688 } 1689 1690 func (fp *PlanAssignmentRequestRequestType_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1691 return fp.WithIArrayItemValue(value) 1692 } 1693 1694 type PlanAssignmentRequestRequestType_FieldSubPath struct { 1695 selector PlanAssignmentRequestRequestType_FieldPathSelector 1696 subPath gotenobject.FieldPath 1697 } 1698 1699 var _ PlanAssignmentRequestRequestType_FieldPath = (*PlanAssignmentRequestRequestType_FieldSubPath)(nil) 1700 1701 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) Selector() PlanAssignmentRequestRequestType_FieldPathSelector { 1702 return fps.selector 1703 } 1704 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) AsAssignSubPath() (PlanAssignmentRequestRequestTypeAssign_FieldPath, bool) { 1705 res, ok := fps.subPath.(PlanAssignmentRequestRequestTypeAssign_FieldPath) 1706 return res, ok 1707 } 1708 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) AsExtendSubPath() (PlanAssignmentRequestRequestTypeExtend_FieldPath, bool) { 1709 res, ok := fps.subPath.(PlanAssignmentRequestRequestTypeExtend_FieldPath) 1710 return res, ok 1711 } 1712 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) AsRedistributeSubPath() (PlanAssignmentRequestRequestTypeRedistribute_FieldPath, bool) { 1713 res, ok := fps.subPath.(PlanAssignmentRequestRequestTypeRedistribute_FieldPath) 1714 return res, ok 1715 } 1716 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) AsUnassignSubPath() (PlanAssignmentRequestRequestTypeUnassign_FieldPath, bool) { 1717 res, ok := fps.subPath.(PlanAssignmentRequestRequestTypeUnassign_FieldPath) 1718 return res, ok 1719 } 1720 1721 // String returns path representation in proto convention 1722 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) String() string { 1723 return fps.selector.String() + "." + fps.subPath.String() 1724 } 1725 1726 // JSONString returns path representation is JSON convention 1727 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) JSONString() string { 1728 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 1729 } 1730 1731 // Get returns all values pointed by selected field from source PlanAssignmentRequest_RequestType 1732 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) Get(source *PlanAssignmentRequest_RequestType) (values []interface{}) { 1733 switch fps.selector { 1734 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1735 values = append(values, fps.subPath.GetRaw(source.GetAssign())...) 1736 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1737 values = append(values, fps.subPath.GetRaw(source.GetExtend())...) 1738 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1739 values = append(values, fps.subPath.GetRaw(source.GetRedistribute())...) 1740 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1741 values = append(values, fps.subPath.GetRaw(source.GetUnassign())...) 1742 default: 1743 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fps.selector)) 1744 } 1745 return 1746 } 1747 1748 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) GetRaw(source proto.Message) []interface{} { 1749 return fps.Get(source.(*PlanAssignmentRequest_RequestType)) 1750 } 1751 1752 // GetSingle returns value of selected field from source PlanAssignmentRequest_RequestType 1753 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) GetSingle(source *PlanAssignmentRequest_RequestType) (interface{}, bool) { 1754 switch fps.selector { 1755 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1756 if source.GetAssign() == nil { 1757 return nil, false 1758 } 1759 return fps.subPath.GetSingleRaw(source.GetAssign()) 1760 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1761 if source.GetExtend() == nil { 1762 return nil, false 1763 } 1764 return fps.subPath.GetSingleRaw(source.GetExtend()) 1765 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1766 if source.GetRedistribute() == nil { 1767 return nil, false 1768 } 1769 return fps.subPath.GetSingleRaw(source.GetRedistribute()) 1770 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1771 if source.GetUnassign() == nil { 1772 return nil, false 1773 } 1774 return fps.subPath.GetSingleRaw(source.GetUnassign()) 1775 default: 1776 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fps.selector)) 1777 } 1778 } 1779 1780 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1781 return fps.GetSingle(source.(*PlanAssignmentRequest_RequestType)) 1782 } 1783 1784 // GetDefault returns a default value of the field type 1785 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) GetDefault() interface{} { 1786 return fps.subPath.GetDefault() 1787 } 1788 1789 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) ClearValue(item *PlanAssignmentRequest_RequestType) { 1790 if item != nil { 1791 switch fps.selector { 1792 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1793 if item.Request != nil { 1794 if item, ok := item.Request.(*PlanAssignmentRequest_RequestType_Assign_); ok { 1795 fps.subPath.ClearValueRaw(item.Assign) 1796 } 1797 } 1798 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1799 if item.Request != nil { 1800 if item, ok := item.Request.(*PlanAssignmentRequest_RequestType_Extend_); ok { 1801 fps.subPath.ClearValueRaw(item.Extend) 1802 } 1803 } 1804 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1805 if item.Request != nil { 1806 if item, ok := item.Request.(*PlanAssignmentRequest_RequestType_Redistribute_); ok { 1807 fps.subPath.ClearValueRaw(item.Redistribute) 1808 } 1809 } 1810 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1811 if item.Request != nil { 1812 if item, ok := item.Request.(*PlanAssignmentRequest_RequestType_Unassign_); ok { 1813 fps.subPath.ClearValueRaw(item.Unassign) 1814 } 1815 } 1816 default: 1817 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fps.selector)) 1818 } 1819 } 1820 } 1821 1822 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) ClearValueRaw(item proto.Message) { 1823 fps.ClearValue(item.(*PlanAssignmentRequest_RequestType)) 1824 } 1825 1826 // IsLeaf - whether field path is holds simple value 1827 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) IsLeaf() bool { 1828 return fps.subPath.IsLeaf() 1829 } 1830 1831 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1832 iPaths := []gotenobject.FieldPath{&PlanAssignmentRequestRequestType_FieldTerminalPath{selector: fps.selector}} 1833 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 1834 return iPaths 1835 } 1836 1837 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) WithIValue(value interface{}) PlanAssignmentRequestRequestType_FieldPathValue { 1838 return &PlanAssignmentRequestRequestType_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 1839 } 1840 1841 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1842 return fps.WithIValue(value) 1843 } 1844 1845 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestType_FieldPathArrayOfValues { 1846 return &PlanAssignmentRequestRequestType_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 1847 } 1848 1849 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1850 return fps.WithIArrayOfValues(values) 1851 } 1852 1853 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestType_FieldPathArrayItemValue { 1854 return &PlanAssignmentRequestRequestType_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 1855 } 1856 1857 func (fps *PlanAssignmentRequestRequestType_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1858 return fps.WithIArrayItemValue(value) 1859 } 1860 1861 // PlanAssignmentRequestRequestType_FieldPathValue allows storing values for RequestType fields according to their type 1862 type PlanAssignmentRequestRequestType_FieldPathValue interface { 1863 PlanAssignmentRequestRequestType_FieldPath 1864 gotenobject.FieldPathValue 1865 SetTo(target **PlanAssignmentRequest_RequestType) 1866 CompareWith(*PlanAssignmentRequest_RequestType) (cmp int, comparable bool) 1867 } 1868 1869 func ParsePlanAssignmentRequestRequestType_FieldPathValue(pathStr, valueStr string) (PlanAssignmentRequestRequestType_FieldPathValue, error) { 1870 fp, err := ParsePlanAssignmentRequestRequestType_FieldPath(pathStr) 1871 if err != nil { 1872 return nil, err 1873 } 1874 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1875 if err != nil { 1876 return nil, status.Errorf(codes.InvalidArgument, "error parsing RequestType field path value from %s: %v", valueStr, err) 1877 } 1878 return fpv.(PlanAssignmentRequestRequestType_FieldPathValue), nil 1879 } 1880 1881 func MustParsePlanAssignmentRequestRequestType_FieldPathValue(pathStr, valueStr string) PlanAssignmentRequestRequestType_FieldPathValue { 1882 fpv, err := ParsePlanAssignmentRequestRequestType_FieldPathValue(pathStr, valueStr) 1883 if err != nil { 1884 panic(err) 1885 } 1886 return fpv 1887 } 1888 1889 type PlanAssignmentRequestRequestType_FieldTerminalPathValue struct { 1890 PlanAssignmentRequestRequestType_FieldTerminalPath 1891 value interface{} 1892 } 1893 1894 var _ PlanAssignmentRequestRequestType_FieldPathValue = (*PlanAssignmentRequestRequestType_FieldTerminalPathValue)(nil) 1895 1896 // GetRawValue returns raw value stored under selected path for 'RequestType' as interface{} 1897 func (fpv *PlanAssignmentRequestRequestType_FieldTerminalPathValue) GetRawValue() interface{} { 1898 return fpv.value 1899 } 1900 func (fpv *PlanAssignmentRequestRequestType_FieldTerminalPathValue) AsAssignValue() (*PlanAssignmentRequest_RequestType_Assign, bool) { 1901 res, ok := fpv.value.(*PlanAssignmentRequest_RequestType_Assign) 1902 return res, ok 1903 } 1904 func (fpv *PlanAssignmentRequestRequestType_FieldTerminalPathValue) AsExtendValue() (*PlanAssignmentRequest_RequestType_Extend, bool) { 1905 res, ok := fpv.value.(*PlanAssignmentRequest_RequestType_Extend) 1906 return res, ok 1907 } 1908 func (fpv *PlanAssignmentRequestRequestType_FieldTerminalPathValue) AsRedistributeValue() (*PlanAssignmentRequest_RequestType_Redistribute, bool) { 1909 res, ok := fpv.value.(*PlanAssignmentRequest_RequestType_Redistribute) 1910 return res, ok 1911 } 1912 func (fpv *PlanAssignmentRequestRequestType_FieldTerminalPathValue) AsUnassignValue() (*PlanAssignmentRequest_RequestType_Unassign, bool) { 1913 res, ok := fpv.value.(*PlanAssignmentRequest_RequestType_Unassign) 1914 return res, ok 1915 } 1916 1917 // SetTo stores value for selected field for object RequestType 1918 func (fpv *PlanAssignmentRequestRequestType_FieldTerminalPathValue) SetTo(target **PlanAssignmentRequest_RequestType) { 1919 if *target == nil { 1920 *target = new(PlanAssignmentRequest_RequestType) 1921 } 1922 switch fpv.selector { 1923 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1924 if _, ok := (*target).Request.(*PlanAssignmentRequest_RequestType_Assign_); !ok { 1925 (*target).Request = &PlanAssignmentRequest_RequestType_Assign_{} 1926 } 1927 (*target).Request.(*PlanAssignmentRequest_RequestType_Assign_).Assign = fpv.value.(*PlanAssignmentRequest_RequestType_Assign) 1928 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1929 if _, ok := (*target).Request.(*PlanAssignmentRequest_RequestType_Extend_); !ok { 1930 (*target).Request = &PlanAssignmentRequest_RequestType_Extend_{} 1931 } 1932 (*target).Request.(*PlanAssignmentRequest_RequestType_Extend_).Extend = fpv.value.(*PlanAssignmentRequest_RequestType_Extend) 1933 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1934 if _, ok := (*target).Request.(*PlanAssignmentRequest_RequestType_Redistribute_); !ok { 1935 (*target).Request = &PlanAssignmentRequest_RequestType_Redistribute_{} 1936 } 1937 (*target).Request.(*PlanAssignmentRequest_RequestType_Redistribute_).Redistribute = fpv.value.(*PlanAssignmentRequest_RequestType_Redistribute) 1938 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1939 if _, ok := (*target).Request.(*PlanAssignmentRequest_RequestType_Unassign_); !ok { 1940 (*target).Request = &PlanAssignmentRequest_RequestType_Unassign_{} 1941 } 1942 (*target).Request.(*PlanAssignmentRequest_RequestType_Unassign_).Unassign = fpv.value.(*PlanAssignmentRequest_RequestType_Unassign) 1943 default: 1944 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fpv.selector)) 1945 } 1946 } 1947 1948 func (fpv *PlanAssignmentRequestRequestType_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1949 typedObject := target.(*PlanAssignmentRequest_RequestType) 1950 fpv.SetTo(&typedObject) 1951 } 1952 1953 // CompareWith compares value in the 'PlanAssignmentRequestRequestType_FieldTerminalPathValue' with the value under path in 'PlanAssignmentRequest_RequestType'. 1954 func (fpv *PlanAssignmentRequestRequestType_FieldTerminalPathValue) CompareWith(source *PlanAssignmentRequest_RequestType) (int, bool) { 1955 switch fpv.selector { 1956 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 1957 return 0, false 1958 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 1959 return 0, false 1960 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 1961 return 0, false 1962 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 1963 return 0, false 1964 default: 1965 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fpv.selector)) 1966 } 1967 } 1968 1969 func (fpv *PlanAssignmentRequestRequestType_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1970 return fpv.CompareWith(source.(*PlanAssignmentRequest_RequestType)) 1971 } 1972 1973 type PlanAssignmentRequestRequestType_FieldSubPathValue struct { 1974 PlanAssignmentRequestRequestType_FieldPath 1975 subPathValue gotenobject.FieldPathValue 1976 } 1977 1978 var _ PlanAssignmentRequestRequestType_FieldPathValue = (*PlanAssignmentRequestRequestType_FieldSubPathValue)(nil) 1979 1980 func (fpvs *PlanAssignmentRequestRequestType_FieldSubPathValue) AsAssignPathValue() (PlanAssignmentRequestRequestTypeAssign_FieldPathValue, bool) { 1981 res, ok := fpvs.subPathValue.(PlanAssignmentRequestRequestTypeAssign_FieldPathValue) 1982 return res, ok 1983 } 1984 func (fpvs *PlanAssignmentRequestRequestType_FieldSubPathValue) AsExtendPathValue() (PlanAssignmentRequestRequestTypeExtend_FieldPathValue, bool) { 1985 res, ok := fpvs.subPathValue.(PlanAssignmentRequestRequestTypeExtend_FieldPathValue) 1986 return res, ok 1987 } 1988 func (fpvs *PlanAssignmentRequestRequestType_FieldSubPathValue) AsRedistributePathValue() (PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue, bool) { 1989 res, ok := fpvs.subPathValue.(PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue) 1990 return res, ok 1991 } 1992 func (fpvs *PlanAssignmentRequestRequestType_FieldSubPathValue) AsUnassignPathValue() (PlanAssignmentRequestRequestTypeUnassign_FieldPathValue, bool) { 1993 res, ok := fpvs.subPathValue.(PlanAssignmentRequestRequestTypeUnassign_FieldPathValue) 1994 return res, ok 1995 } 1996 1997 func (fpvs *PlanAssignmentRequestRequestType_FieldSubPathValue) SetTo(target **PlanAssignmentRequest_RequestType) { 1998 if *target == nil { 1999 *target = new(PlanAssignmentRequest_RequestType) 2000 } 2001 switch fpvs.Selector() { 2002 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 2003 if _, ok := (*target).Request.(*PlanAssignmentRequest_RequestType_Assign_); !ok { 2004 (*target).Request = &PlanAssignmentRequest_RequestType_Assign_{} 2005 } 2006 fpvs.subPathValue.(PlanAssignmentRequestRequestTypeAssign_FieldPathValue).SetTo(&(*target).Request.(*PlanAssignmentRequest_RequestType_Assign_).Assign) 2007 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 2008 if _, ok := (*target).Request.(*PlanAssignmentRequest_RequestType_Extend_); !ok { 2009 (*target).Request = &PlanAssignmentRequest_RequestType_Extend_{} 2010 } 2011 fpvs.subPathValue.(PlanAssignmentRequestRequestTypeExtend_FieldPathValue).SetTo(&(*target).Request.(*PlanAssignmentRequest_RequestType_Extend_).Extend) 2012 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 2013 if _, ok := (*target).Request.(*PlanAssignmentRequest_RequestType_Redistribute_); !ok { 2014 (*target).Request = &PlanAssignmentRequest_RequestType_Redistribute_{} 2015 } 2016 fpvs.subPathValue.(PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue).SetTo(&(*target).Request.(*PlanAssignmentRequest_RequestType_Redistribute_).Redistribute) 2017 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 2018 if _, ok := (*target).Request.(*PlanAssignmentRequest_RequestType_Unassign_); !ok { 2019 (*target).Request = &PlanAssignmentRequest_RequestType_Unassign_{} 2020 } 2021 fpvs.subPathValue.(PlanAssignmentRequestRequestTypeUnassign_FieldPathValue).SetTo(&(*target).Request.(*PlanAssignmentRequest_RequestType_Unassign_).Unassign) 2022 default: 2023 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fpvs.Selector())) 2024 } 2025 } 2026 2027 func (fpvs *PlanAssignmentRequestRequestType_FieldSubPathValue) SetToRaw(target proto.Message) { 2028 typedObject := target.(*PlanAssignmentRequest_RequestType) 2029 fpvs.SetTo(&typedObject) 2030 } 2031 2032 func (fpvs *PlanAssignmentRequestRequestType_FieldSubPathValue) GetRawValue() interface{} { 2033 return fpvs.subPathValue.GetRawValue() 2034 } 2035 2036 func (fpvs *PlanAssignmentRequestRequestType_FieldSubPathValue) CompareWith(source *PlanAssignmentRequest_RequestType) (int, bool) { 2037 switch fpvs.Selector() { 2038 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 2039 return fpvs.subPathValue.(PlanAssignmentRequestRequestTypeAssign_FieldPathValue).CompareWith(source.GetAssign()) 2040 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 2041 return fpvs.subPathValue.(PlanAssignmentRequestRequestTypeExtend_FieldPathValue).CompareWith(source.GetExtend()) 2042 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 2043 return fpvs.subPathValue.(PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue).CompareWith(source.GetRedistribute()) 2044 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 2045 return fpvs.subPathValue.(PlanAssignmentRequestRequestTypeUnassign_FieldPathValue).CompareWith(source.GetUnassign()) 2046 default: 2047 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fpvs.Selector())) 2048 } 2049 } 2050 2051 func (fpvs *PlanAssignmentRequestRequestType_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2052 return fpvs.CompareWith(source.(*PlanAssignmentRequest_RequestType)) 2053 } 2054 2055 // PlanAssignmentRequestRequestType_FieldPathArrayItemValue allows storing single item in Path-specific values for RequestType according to their type 2056 // Present only for array (repeated) types. 2057 type PlanAssignmentRequestRequestType_FieldPathArrayItemValue interface { 2058 gotenobject.FieldPathArrayItemValue 2059 PlanAssignmentRequestRequestType_FieldPath 2060 ContainsValue(*PlanAssignmentRequest_RequestType) bool 2061 } 2062 2063 // ParsePlanAssignmentRequestRequestType_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2064 func ParsePlanAssignmentRequestRequestType_FieldPathArrayItemValue(pathStr, valueStr string) (PlanAssignmentRequestRequestType_FieldPathArrayItemValue, error) { 2065 fp, err := ParsePlanAssignmentRequestRequestType_FieldPath(pathStr) 2066 if err != nil { 2067 return nil, err 2068 } 2069 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2070 if err != nil { 2071 return nil, status.Errorf(codes.InvalidArgument, "error parsing RequestType field path array item value from %s: %v", valueStr, err) 2072 } 2073 return fpaiv.(PlanAssignmentRequestRequestType_FieldPathArrayItemValue), nil 2074 } 2075 2076 func MustParsePlanAssignmentRequestRequestType_FieldPathArrayItemValue(pathStr, valueStr string) PlanAssignmentRequestRequestType_FieldPathArrayItemValue { 2077 fpaiv, err := ParsePlanAssignmentRequestRequestType_FieldPathArrayItemValue(pathStr, valueStr) 2078 if err != nil { 2079 panic(err) 2080 } 2081 return fpaiv 2082 } 2083 2084 type PlanAssignmentRequestRequestType_FieldTerminalPathArrayItemValue struct { 2085 PlanAssignmentRequestRequestType_FieldTerminalPath 2086 value interface{} 2087 } 2088 2089 var _ PlanAssignmentRequestRequestType_FieldPathArrayItemValue = (*PlanAssignmentRequestRequestType_FieldTerminalPathArrayItemValue)(nil) 2090 2091 // GetRawValue returns stored element value for array in object PlanAssignmentRequest_RequestType as interface{} 2092 func (fpaiv *PlanAssignmentRequestRequestType_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2093 return fpaiv.value 2094 } 2095 2096 func (fpaiv *PlanAssignmentRequestRequestType_FieldTerminalPathArrayItemValue) GetSingle(source *PlanAssignmentRequest_RequestType) (interface{}, bool) { 2097 return nil, false 2098 } 2099 2100 func (fpaiv *PlanAssignmentRequestRequestType_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2101 return fpaiv.GetSingle(source.(*PlanAssignmentRequest_RequestType)) 2102 } 2103 2104 // Contains returns a boolean indicating if value that is being held is present in given 'RequestType' 2105 func (fpaiv *PlanAssignmentRequestRequestType_FieldTerminalPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_RequestType) bool { 2106 slice := fpaiv.PlanAssignmentRequestRequestType_FieldTerminalPath.Get(source) 2107 for _, v := range slice { 2108 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2109 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2110 return true 2111 } 2112 } else if reflect.DeepEqual(v, fpaiv.value) { 2113 return true 2114 } 2115 } 2116 return false 2117 } 2118 2119 type PlanAssignmentRequestRequestType_FieldSubPathArrayItemValue struct { 2120 PlanAssignmentRequestRequestType_FieldPath 2121 subPathItemValue gotenobject.FieldPathArrayItemValue 2122 } 2123 2124 // GetRawValue returns stored array item value 2125 func (fpaivs *PlanAssignmentRequestRequestType_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 2126 return fpaivs.subPathItemValue.GetRawItemValue() 2127 } 2128 func (fpaivs *PlanAssignmentRequestRequestType_FieldSubPathArrayItemValue) AsAssignPathItemValue() (PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue, bool) { 2129 res, ok := fpaivs.subPathItemValue.(PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue) 2130 return res, ok 2131 } 2132 func (fpaivs *PlanAssignmentRequestRequestType_FieldSubPathArrayItemValue) AsExtendPathItemValue() (PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue, bool) { 2133 res, ok := fpaivs.subPathItemValue.(PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue) 2134 return res, ok 2135 } 2136 func (fpaivs *PlanAssignmentRequestRequestType_FieldSubPathArrayItemValue) AsRedistributePathItemValue() (PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue, bool) { 2137 res, ok := fpaivs.subPathItemValue.(PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue) 2138 return res, ok 2139 } 2140 func (fpaivs *PlanAssignmentRequestRequestType_FieldSubPathArrayItemValue) AsUnassignPathItemValue() (PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue, bool) { 2141 res, ok := fpaivs.subPathItemValue.(PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue) 2142 return res, ok 2143 } 2144 2145 // Contains returns a boolean indicating if value that is being held is present in given 'RequestType' 2146 func (fpaivs *PlanAssignmentRequestRequestType_FieldSubPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_RequestType) bool { 2147 switch fpaivs.Selector() { 2148 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 2149 return fpaivs.subPathItemValue.(PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue).ContainsValue(source.GetAssign()) 2150 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 2151 return fpaivs.subPathItemValue.(PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue).ContainsValue(source.GetExtend()) 2152 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 2153 return fpaivs.subPathItemValue.(PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue).ContainsValue(source.GetRedistribute()) 2154 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 2155 return fpaivs.subPathItemValue.(PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue).ContainsValue(source.GetUnassign()) 2156 default: 2157 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType: %d", fpaivs.Selector())) 2158 } 2159 } 2160 2161 // PlanAssignmentRequestRequestType_FieldPathArrayOfValues allows storing slice of values for RequestType fields according to their type 2162 type PlanAssignmentRequestRequestType_FieldPathArrayOfValues interface { 2163 gotenobject.FieldPathArrayOfValues 2164 PlanAssignmentRequestRequestType_FieldPath 2165 } 2166 2167 func ParsePlanAssignmentRequestRequestType_FieldPathArrayOfValues(pathStr, valuesStr string) (PlanAssignmentRequestRequestType_FieldPathArrayOfValues, error) { 2168 fp, err := ParsePlanAssignmentRequestRequestType_FieldPath(pathStr) 2169 if err != nil { 2170 return nil, err 2171 } 2172 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2173 if err != nil { 2174 return nil, status.Errorf(codes.InvalidArgument, "error parsing RequestType field path array of values from %s: %v", valuesStr, err) 2175 } 2176 return fpaov.(PlanAssignmentRequestRequestType_FieldPathArrayOfValues), nil 2177 } 2178 2179 func MustParsePlanAssignmentRequestRequestType_FieldPathArrayOfValues(pathStr, valuesStr string) PlanAssignmentRequestRequestType_FieldPathArrayOfValues { 2180 fpaov, err := ParsePlanAssignmentRequestRequestType_FieldPathArrayOfValues(pathStr, valuesStr) 2181 if err != nil { 2182 panic(err) 2183 } 2184 return fpaov 2185 } 2186 2187 type PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues struct { 2188 PlanAssignmentRequestRequestType_FieldTerminalPath 2189 values interface{} 2190 } 2191 2192 var _ PlanAssignmentRequestRequestType_FieldPathArrayOfValues = (*PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues)(nil) 2193 2194 func (fpaov *PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2195 switch fpaov.selector { 2196 case PlanAssignmentRequestRequestType_FieldPathSelectorAssign: 2197 for _, v := range fpaov.values.([]*PlanAssignmentRequest_RequestType_Assign) { 2198 values = append(values, v) 2199 } 2200 case PlanAssignmentRequestRequestType_FieldPathSelectorExtend: 2201 for _, v := range fpaov.values.([]*PlanAssignmentRequest_RequestType_Extend) { 2202 values = append(values, v) 2203 } 2204 case PlanAssignmentRequestRequestType_FieldPathSelectorRedistribute: 2205 for _, v := range fpaov.values.([]*PlanAssignmentRequest_RequestType_Redistribute) { 2206 values = append(values, v) 2207 } 2208 case PlanAssignmentRequestRequestType_FieldPathSelectorUnassign: 2209 for _, v := range fpaov.values.([]*PlanAssignmentRequest_RequestType_Unassign) { 2210 values = append(values, v) 2211 } 2212 } 2213 return 2214 } 2215 func (fpaov *PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues) AsAssignArrayOfValues() ([]*PlanAssignmentRequest_RequestType_Assign, bool) { 2216 res, ok := fpaov.values.([]*PlanAssignmentRequest_RequestType_Assign) 2217 return res, ok 2218 } 2219 func (fpaov *PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues) AsExtendArrayOfValues() ([]*PlanAssignmentRequest_RequestType_Extend, bool) { 2220 res, ok := fpaov.values.([]*PlanAssignmentRequest_RequestType_Extend) 2221 return res, ok 2222 } 2223 func (fpaov *PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues) AsRedistributeArrayOfValues() ([]*PlanAssignmentRequest_RequestType_Redistribute, bool) { 2224 res, ok := fpaov.values.([]*PlanAssignmentRequest_RequestType_Redistribute) 2225 return res, ok 2226 } 2227 func (fpaov *PlanAssignmentRequestRequestType_FieldTerminalPathArrayOfValues) AsUnassignArrayOfValues() ([]*PlanAssignmentRequest_RequestType_Unassign, bool) { 2228 res, ok := fpaov.values.([]*PlanAssignmentRequest_RequestType_Unassign) 2229 return res, ok 2230 } 2231 2232 type PlanAssignmentRequestRequestType_FieldSubPathArrayOfValues struct { 2233 PlanAssignmentRequestRequestType_FieldPath 2234 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 2235 } 2236 2237 var _ PlanAssignmentRequestRequestType_FieldPathArrayOfValues = (*PlanAssignmentRequestRequestType_FieldSubPathArrayOfValues)(nil) 2238 2239 func (fpsaov *PlanAssignmentRequestRequestType_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 2240 return fpsaov.subPathArrayOfValues.GetRawValues() 2241 } 2242 func (fpsaov *PlanAssignmentRequestRequestType_FieldSubPathArrayOfValues) AsAssignPathArrayOfValues() (PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues, bool) { 2243 res, ok := fpsaov.subPathArrayOfValues.(PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues) 2244 return res, ok 2245 } 2246 func (fpsaov *PlanAssignmentRequestRequestType_FieldSubPathArrayOfValues) AsExtendPathArrayOfValues() (PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues, bool) { 2247 res, ok := fpsaov.subPathArrayOfValues.(PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues) 2248 return res, ok 2249 } 2250 func (fpsaov *PlanAssignmentRequestRequestType_FieldSubPathArrayOfValues) AsRedistributePathArrayOfValues() (PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues, bool) { 2251 res, ok := fpsaov.subPathArrayOfValues.(PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues) 2252 return res, ok 2253 } 2254 func (fpsaov *PlanAssignmentRequestRequestType_FieldSubPathArrayOfValues) AsUnassignPathArrayOfValues() (PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues, bool) { 2255 res, ok := fpsaov.subPathArrayOfValues.(PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues) 2256 return res, ok 2257 } 2258 2259 // FieldPath provides implementation to handle 2260 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 2261 type PlanAssignmentRequestRequestTypeAssign_FieldPath interface { 2262 gotenobject.FieldPath 2263 Selector() PlanAssignmentRequestRequestTypeAssign_FieldPathSelector 2264 Get(source *PlanAssignmentRequest_RequestType_Assign) []interface{} 2265 GetSingle(source *PlanAssignmentRequest_RequestType_Assign) (interface{}, bool) 2266 ClearValue(item *PlanAssignmentRequest_RequestType_Assign) 2267 2268 // Those methods build corresponding PlanAssignmentRequestRequestTypeAssign_FieldPathValue 2269 // (or array of values) and holds passed value. Panics if injected type is incorrect. 2270 WithIValue(value interface{}) PlanAssignmentRequestRequestTypeAssign_FieldPathValue 2271 WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues 2272 WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue 2273 } 2274 2275 type PlanAssignmentRequestRequestTypeAssign_FieldPathSelector int32 2276 2277 const ( 2278 PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan PlanAssignmentRequestRequestTypeAssign_FieldPathSelector = 0 2279 PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions PlanAssignmentRequestRequestTypeAssign_FieldPathSelector = 1 2280 PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions PlanAssignmentRequestRequestTypeAssign_FieldPathSelector = 2 2281 ) 2282 2283 func (s PlanAssignmentRequestRequestTypeAssign_FieldPathSelector) String() string { 2284 switch s { 2285 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2286 return "plan" 2287 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2288 return "extensions" 2289 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2290 return "regional_distributions" 2291 default: 2292 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", s)) 2293 } 2294 } 2295 2296 func BuildPlanAssignmentRequestRequestTypeAssign_FieldPath(fp gotenobject.RawFieldPath) (PlanAssignmentRequestRequestTypeAssign_FieldPath, error) { 2297 if len(fp) == 0 { 2298 return nil, status.Error(codes.InvalidArgument, "empty field path for object PlanAssignmentRequest_RequestType_Assign") 2299 } 2300 if len(fp) == 1 { 2301 switch fp[0] { 2302 case "plan": 2303 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath{selector: PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan}, nil 2304 case "extensions": 2305 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath{selector: PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions}, nil 2306 case "regional_distributions", "regionalDistributions", "regional-distributions": 2307 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath{selector: PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions}, nil 2308 } 2309 } else { 2310 switch fp[0] { 2311 case "extensions": 2312 if subpath, err := common.BuildAllowance_FieldPath(fp[1:]); err != nil { 2313 return nil, err 2314 } else { 2315 return &PlanAssignmentRequestRequestTypeAssign_FieldSubPath{selector: PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions, subPath: subpath}, nil 2316 } 2317 case "regional_distributions", "regionalDistributions", "regional-distributions": 2318 if subpath, err := common.BuildRegionalDistribution_FieldPath(fp[1:]); err != nil { 2319 return nil, err 2320 } else { 2321 return &PlanAssignmentRequestRequestTypeAssign_FieldSubPath{selector: PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions, subPath: subpath}, nil 2322 } 2323 } 2324 } 2325 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PlanAssignmentRequest_RequestType_Assign", fp) 2326 } 2327 2328 func ParsePlanAssignmentRequestRequestTypeAssign_FieldPath(rawField string) (PlanAssignmentRequestRequestTypeAssign_FieldPath, error) { 2329 fp, err := gotenobject.ParseRawFieldPath(rawField) 2330 if err != nil { 2331 return nil, err 2332 } 2333 return BuildPlanAssignmentRequestRequestTypeAssign_FieldPath(fp) 2334 } 2335 2336 func MustParsePlanAssignmentRequestRequestTypeAssign_FieldPath(rawField string) PlanAssignmentRequestRequestTypeAssign_FieldPath { 2337 fp, err := ParsePlanAssignmentRequestRequestTypeAssign_FieldPath(rawField) 2338 if err != nil { 2339 panic(err) 2340 } 2341 return fp 2342 } 2343 2344 type PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath struct { 2345 selector PlanAssignmentRequestRequestTypeAssign_FieldPathSelector 2346 } 2347 2348 var _ PlanAssignmentRequestRequestTypeAssign_FieldPath = (*PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath)(nil) 2349 2350 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) Selector() PlanAssignmentRequestRequestTypeAssign_FieldPathSelector { 2351 return fp.selector 2352 } 2353 2354 // String returns path representation in proto convention 2355 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) String() string { 2356 return fp.selector.String() 2357 } 2358 2359 // JSONString returns path representation is JSON convention 2360 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) JSONString() string { 2361 return strcase.ToLowerCamel(fp.String()) 2362 } 2363 2364 // Get returns all values pointed by specific field from source PlanAssignmentRequest_RequestType_Assign 2365 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) Get(source *PlanAssignmentRequest_RequestType_Assign) (values []interface{}) { 2366 if source != nil { 2367 switch fp.selector { 2368 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2369 if source.Plan != nil { 2370 values = append(values, source.Plan) 2371 } 2372 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2373 for _, value := range source.GetExtensions() { 2374 values = append(values, value) 2375 } 2376 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2377 for _, value := range source.GetRegionalDistributions() { 2378 values = append(values, value) 2379 } 2380 default: 2381 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fp.selector)) 2382 } 2383 } 2384 return 2385 } 2386 2387 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 2388 return fp.Get(source.(*PlanAssignmentRequest_RequestType_Assign)) 2389 } 2390 2391 // GetSingle returns value pointed by specific field of from source PlanAssignmentRequest_RequestType_Assign 2392 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) GetSingle(source *PlanAssignmentRequest_RequestType_Assign) (interface{}, bool) { 2393 switch fp.selector { 2394 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2395 res := source.GetPlan() 2396 return res, res != nil 2397 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2398 res := source.GetExtensions() 2399 return res, res != nil 2400 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2401 res := source.GetRegionalDistributions() 2402 return res, res != nil 2403 default: 2404 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fp.selector)) 2405 } 2406 } 2407 2408 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2409 return fp.GetSingle(source.(*PlanAssignmentRequest_RequestType_Assign)) 2410 } 2411 2412 // GetDefault returns a default value of the field type 2413 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) GetDefault() interface{} { 2414 switch fp.selector { 2415 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2416 return (*plan.Reference)(nil) 2417 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2418 return ([]*common.Allowance)(nil) 2419 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2420 return ([]*common.RegionalDistribution)(nil) 2421 default: 2422 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fp.selector)) 2423 } 2424 } 2425 2426 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) ClearValue(item *PlanAssignmentRequest_RequestType_Assign) { 2427 if item != nil { 2428 switch fp.selector { 2429 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2430 item.Plan = nil 2431 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2432 item.Extensions = nil 2433 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2434 item.RegionalDistributions = nil 2435 default: 2436 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fp.selector)) 2437 } 2438 } 2439 } 2440 2441 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) ClearValueRaw(item proto.Message) { 2442 fp.ClearValue(item.(*PlanAssignmentRequest_RequestType_Assign)) 2443 } 2444 2445 // IsLeaf - whether field path is holds simple value 2446 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) IsLeaf() bool { 2447 return fp.selector == PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan 2448 } 2449 2450 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2451 return []gotenobject.FieldPath{fp} 2452 } 2453 2454 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) WithIValue(value interface{}) PlanAssignmentRequestRequestTypeAssign_FieldPathValue { 2455 switch fp.selector { 2456 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2457 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue{PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath: *fp, value: value.(*plan.Reference)} 2458 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2459 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue{PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath: *fp, value: value.([]*common.Allowance)} 2460 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2461 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue{PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath: *fp, value: value.([]*common.RegionalDistribution)} 2462 default: 2463 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fp.selector)) 2464 } 2465 } 2466 2467 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2468 return fp.WithIValue(value) 2469 } 2470 2471 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues { 2472 fpaov := &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath: *fp} 2473 switch fp.selector { 2474 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2475 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath: *fp, values: values.([]*plan.Reference)} 2476 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2477 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath: *fp, values: values.([][]*common.Allowance)} 2478 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2479 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath: *fp, values: values.([][]*common.RegionalDistribution)} 2480 default: 2481 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fp.selector)) 2482 } 2483 return fpaov 2484 } 2485 2486 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2487 return fp.WithIArrayOfValues(values) 2488 } 2489 2490 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue { 2491 switch fp.selector { 2492 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2493 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue{PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath: *fp, value: value.(*common.Allowance)} 2494 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2495 return &PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue{PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath: *fp, value: value.(*common.RegionalDistribution)} 2496 default: 2497 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fp.selector)) 2498 } 2499 } 2500 2501 func (fp *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2502 return fp.WithIArrayItemValue(value) 2503 } 2504 2505 type PlanAssignmentRequestRequestTypeAssign_FieldSubPath struct { 2506 selector PlanAssignmentRequestRequestTypeAssign_FieldPathSelector 2507 subPath gotenobject.FieldPath 2508 } 2509 2510 var _ PlanAssignmentRequestRequestTypeAssign_FieldPath = (*PlanAssignmentRequestRequestTypeAssign_FieldSubPath)(nil) 2511 2512 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) Selector() PlanAssignmentRequestRequestTypeAssign_FieldPathSelector { 2513 return fps.selector 2514 } 2515 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) AsExtensionsSubPath() (common.Allowance_FieldPath, bool) { 2516 res, ok := fps.subPath.(common.Allowance_FieldPath) 2517 return res, ok 2518 } 2519 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) AsRegionalDistributionsSubPath() (common.RegionalDistribution_FieldPath, bool) { 2520 res, ok := fps.subPath.(common.RegionalDistribution_FieldPath) 2521 return res, ok 2522 } 2523 2524 // String returns path representation in proto convention 2525 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) String() string { 2526 return fps.selector.String() + "." + fps.subPath.String() 2527 } 2528 2529 // JSONString returns path representation is JSON convention 2530 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) JSONString() string { 2531 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 2532 } 2533 2534 // Get returns all values pointed by selected field from source PlanAssignmentRequest_RequestType_Assign 2535 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) Get(source *PlanAssignmentRequest_RequestType_Assign) (values []interface{}) { 2536 switch fps.selector { 2537 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2538 for _, item := range source.GetExtensions() { 2539 values = append(values, fps.subPath.GetRaw(item)...) 2540 } 2541 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2542 for _, item := range source.GetRegionalDistributions() { 2543 values = append(values, fps.subPath.GetRaw(item)...) 2544 } 2545 default: 2546 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fps.selector)) 2547 } 2548 return 2549 } 2550 2551 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) GetRaw(source proto.Message) []interface{} { 2552 return fps.Get(source.(*PlanAssignmentRequest_RequestType_Assign)) 2553 } 2554 2555 // GetSingle returns value of selected field from source PlanAssignmentRequest_RequestType_Assign 2556 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) GetSingle(source *PlanAssignmentRequest_RequestType_Assign) (interface{}, bool) { 2557 switch fps.selector { 2558 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2559 if len(source.GetExtensions()) == 0 { 2560 return nil, false 2561 } 2562 return fps.subPath.GetSingleRaw(source.GetExtensions()[0]) 2563 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2564 if len(source.GetRegionalDistributions()) == 0 { 2565 return nil, false 2566 } 2567 return fps.subPath.GetSingleRaw(source.GetRegionalDistributions()[0]) 2568 default: 2569 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fps.selector)) 2570 } 2571 } 2572 2573 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 2574 return fps.GetSingle(source.(*PlanAssignmentRequest_RequestType_Assign)) 2575 } 2576 2577 // GetDefault returns a default value of the field type 2578 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) GetDefault() interface{} { 2579 return fps.subPath.GetDefault() 2580 } 2581 2582 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) ClearValue(item *PlanAssignmentRequest_RequestType_Assign) { 2583 if item != nil { 2584 switch fps.selector { 2585 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2586 for _, subItem := range item.Extensions { 2587 fps.subPath.ClearValueRaw(subItem) 2588 } 2589 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2590 for _, subItem := range item.RegionalDistributions { 2591 fps.subPath.ClearValueRaw(subItem) 2592 } 2593 default: 2594 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fps.selector)) 2595 } 2596 } 2597 } 2598 2599 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) ClearValueRaw(item proto.Message) { 2600 fps.ClearValue(item.(*PlanAssignmentRequest_RequestType_Assign)) 2601 } 2602 2603 // IsLeaf - whether field path is holds simple value 2604 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) IsLeaf() bool { 2605 return fps.subPath.IsLeaf() 2606 } 2607 2608 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 2609 iPaths := []gotenobject.FieldPath{&PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath{selector: fps.selector}} 2610 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 2611 return iPaths 2612 } 2613 2614 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) WithIValue(value interface{}) PlanAssignmentRequestRequestTypeAssign_FieldPathValue { 2615 return &PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 2616 } 2617 2618 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 2619 return fps.WithIValue(value) 2620 } 2621 2622 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues { 2623 return &PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 2624 } 2625 2626 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 2627 return fps.WithIArrayOfValues(values) 2628 } 2629 2630 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue { 2631 return &PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 2632 } 2633 2634 func (fps *PlanAssignmentRequestRequestTypeAssign_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 2635 return fps.WithIArrayItemValue(value) 2636 } 2637 2638 // PlanAssignmentRequestRequestTypeAssign_FieldPathValue allows storing values for Assign fields according to their type 2639 type PlanAssignmentRequestRequestTypeAssign_FieldPathValue interface { 2640 PlanAssignmentRequestRequestTypeAssign_FieldPath 2641 gotenobject.FieldPathValue 2642 SetTo(target **PlanAssignmentRequest_RequestType_Assign) 2643 CompareWith(*PlanAssignmentRequest_RequestType_Assign) (cmp int, comparable bool) 2644 } 2645 2646 func ParsePlanAssignmentRequestRequestTypeAssign_FieldPathValue(pathStr, valueStr string) (PlanAssignmentRequestRequestTypeAssign_FieldPathValue, error) { 2647 fp, err := ParsePlanAssignmentRequestRequestTypeAssign_FieldPath(pathStr) 2648 if err != nil { 2649 return nil, err 2650 } 2651 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 2652 if err != nil { 2653 return nil, status.Errorf(codes.InvalidArgument, "error parsing Assign field path value from %s: %v", valueStr, err) 2654 } 2655 return fpv.(PlanAssignmentRequestRequestTypeAssign_FieldPathValue), nil 2656 } 2657 2658 func MustParsePlanAssignmentRequestRequestTypeAssign_FieldPathValue(pathStr, valueStr string) PlanAssignmentRequestRequestTypeAssign_FieldPathValue { 2659 fpv, err := ParsePlanAssignmentRequestRequestTypeAssign_FieldPathValue(pathStr, valueStr) 2660 if err != nil { 2661 panic(err) 2662 } 2663 return fpv 2664 } 2665 2666 type PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue struct { 2667 PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath 2668 value interface{} 2669 } 2670 2671 var _ PlanAssignmentRequestRequestTypeAssign_FieldPathValue = (*PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue)(nil) 2672 2673 // GetRawValue returns raw value stored under selected path for 'Assign' as interface{} 2674 func (fpv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue) GetRawValue() interface{} { 2675 return fpv.value 2676 } 2677 func (fpv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue) AsPlanValue() (*plan.Reference, bool) { 2678 res, ok := fpv.value.(*plan.Reference) 2679 return res, ok 2680 } 2681 func (fpv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue) AsExtensionsValue() ([]*common.Allowance, bool) { 2682 res, ok := fpv.value.([]*common.Allowance) 2683 return res, ok 2684 } 2685 func (fpv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue) AsRegionalDistributionsValue() ([]*common.RegionalDistribution, bool) { 2686 res, ok := fpv.value.([]*common.RegionalDistribution) 2687 return res, ok 2688 } 2689 2690 // SetTo stores value for selected field for object Assign 2691 func (fpv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue) SetTo(target **PlanAssignmentRequest_RequestType_Assign) { 2692 if *target == nil { 2693 *target = new(PlanAssignmentRequest_RequestType_Assign) 2694 } 2695 switch fpv.selector { 2696 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2697 (*target).Plan = fpv.value.(*plan.Reference) 2698 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2699 (*target).Extensions = fpv.value.([]*common.Allowance) 2700 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2701 (*target).RegionalDistributions = fpv.value.([]*common.RegionalDistribution) 2702 default: 2703 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fpv.selector)) 2704 } 2705 } 2706 2707 func (fpv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2708 typedObject := target.(*PlanAssignmentRequest_RequestType_Assign) 2709 fpv.SetTo(&typedObject) 2710 } 2711 2712 // CompareWith compares value in the 'PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue' with the value under path in 'PlanAssignmentRequest_RequestType_Assign'. 2713 func (fpv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue) CompareWith(source *PlanAssignmentRequest_RequestType_Assign) (int, bool) { 2714 switch fpv.selector { 2715 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2716 leftValue := fpv.value.(*plan.Reference) 2717 rightValue := source.GetPlan() 2718 if leftValue == nil { 2719 if rightValue != nil { 2720 return -1, true 2721 } 2722 return 0, true 2723 } 2724 if rightValue == nil { 2725 return 1, true 2726 } 2727 if leftValue.String() == rightValue.String() { 2728 return 0, true 2729 } else if leftValue.String() < rightValue.String() { 2730 return -1, true 2731 } else { 2732 return 1, true 2733 } 2734 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2735 return 0, false 2736 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2737 return 0, false 2738 default: 2739 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fpv.selector)) 2740 } 2741 } 2742 2743 func (fpv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2744 return fpv.CompareWith(source.(*PlanAssignmentRequest_RequestType_Assign)) 2745 } 2746 2747 type PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue struct { 2748 PlanAssignmentRequestRequestTypeAssign_FieldPath 2749 subPathValue gotenobject.FieldPathValue 2750 } 2751 2752 var _ PlanAssignmentRequestRequestTypeAssign_FieldPathValue = (*PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue)(nil) 2753 2754 func (fpvs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue) AsExtensionsPathValue() (common.Allowance_FieldPathValue, bool) { 2755 res, ok := fpvs.subPathValue.(common.Allowance_FieldPathValue) 2756 return res, ok 2757 } 2758 func (fpvs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue) AsRegionalDistributionsPathValue() (common.RegionalDistribution_FieldPathValue, bool) { 2759 res, ok := fpvs.subPathValue.(common.RegionalDistribution_FieldPathValue) 2760 return res, ok 2761 } 2762 2763 func (fpvs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue) SetTo(target **PlanAssignmentRequest_RequestType_Assign) { 2764 if *target == nil { 2765 *target = new(PlanAssignmentRequest_RequestType_Assign) 2766 } 2767 switch fpvs.Selector() { 2768 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2769 panic("FieldPath setter is unsupported for array subpaths") 2770 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2771 panic("FieldPath setter is unsupported for array subpaths") 2772 default: 2773 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fpvs.Selector())) 2774 } 2775 } 2776 2777 func (fpvs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue) SetToRaw(target proto.Message) { 2778 typedObject := target.(*PlanAssignmentRequest_RequestType_Assign) 2779 fpvs.SetTo(&typedObject) 2780 } 2781 2782 func (fpvs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue) GetRawValue() interface{} { 2783 return fpvs.subPathValue.GetRawValue() 2784 } 2785 2786 func (fpvs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue) CompareWith(source *PlanAssignmentRequest_RequestType_Assign) (int, bool) { 2787 switch fpvs.Selector() { 2788 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2789 return 0, false // repeated field 2790 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2791 return 0, false // repeated field 2792 default: 2793 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fpvs.Selector())) 2794 } 2795 } 2796 2797 func (fpvs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2798 return fpvs.CompareWith(source.(*PlanAssignmentRequest_RequestType_Assign)) 2799 } 2800 2801 // PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue allows storing single item in Path-specific values for Assign according to their type 2802 // Present only for array (repeated) types. 2803 type PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue interface { 2804 gotenobject.FieldPathArrayItemValue 2805 PlanAssignmentRequestRequestTypeAssign_FieldPath 2806 ContainsValue(*PlanAssignmentRequest_RequestType_Assign) bool 2807 } 2808 2809 // ParsePlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2810 func ParsePlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue(pathStr, valueStr string) (PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue, error) { 2811 fp, err := ParsePlanAssignmentRequestRequestTypeAssign_FieldPath(pathStr) 2812 if err != nil { 2813 return nil, err 2814 } 2815 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2816 if err != nil { 2817 return nil, status.Errorf(codes.InvalidArgument, "error parsing Assign field path array item value from %s: %v", valueStr, err) 2818 } 2819 return fpaiv.(PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue), nil 2820 } 2821 2822 func MustParsePlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue(pathStr, valueStr string) PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue { 2823 fpaiv, err := ParsePlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue(pathStr, valueStr) 2824 if err != nil { 2825 panic(err) 2826 } 2827 return fpaiv 2828 } 2829 2830 type PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue struct { 2831 PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath 2832 value interface{} 2833 } 2834 2835 var _ PlanAssignmentRequestRequestTypeAssign_FieldPathArrayItemValue = (*PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue)(nil) 2836 2837 // GetRawValue returns stored element value for array in object PlanAssignmentRequest_RequestType_Assign as interface{} 2838 func (fpaiv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2839 return fpaiv.value 2840 } 2841 func (fpaiv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue) AsExtensionsItemValue() (*common.Allowance, bool) { 2842 res, ok := fpaiv.value.(*common.Allowance) 2843 return res, ok 2844 } 2845 func (fpaiv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue) AsRegionalDistributionsItemValue() (*common.RegionalDistribution, bool) { 2846 res, ok := fpaiv.value.(*common.RegionalDistribution) 2847 return res, ok 2848 } 2849 2850 func (fpaiv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue) GetSingle(source *PlanAssignmentRequest_RequestType_Assign) (interface{}, bool) { 2851 return nil, false 2852 } 2853 2854 func (fpaiv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2855 return fpaiv.GetSingle(source.(*PlanAssignmentRequest_RequestType_Assign)) 2856 } 2857 2858 // Contains returns a boolean indicating if value that is being held is present in given 'Assign' 2859 func (fpaiv *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_RequestType_Assign) bool { 2860 slice := fpaiv.PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath.Get(source) 2861 for _, v := range slice { 2862 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2863 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2864 return true 2865 } 2866 } else if reflect.DeepEqual(v, fpaiv.value) { 2867 return true 2868 } 2869 } 2870 return false 2871 } 2872 2873 type PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayItemValue struct { 2874 PlanAssignmentRequestRequestTypeAssign_FieldPath 2875 subPathItemValue gotenobject.FieldPathArrayItemValue 2876 } 2877 2878 // GetRawValue returns stored array item value 2879 func (fpaivs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 2880 return fpaivs.subPathItemValue.GetRawItemValue() 2881 } 2882 func (fpaivs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayItemValue) AsExtensionsPathItemValue() (common.Allowance_FieldPathArrayItemValue, bool) { 2883 res, ok := fpaivs.subPathItemValue.(common.Allowance_FieldPathArrayItemValue) 2884 return res, ok 2885 } 2886 func (fpaivs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayItemValue) AsRegionalDistributionsPathItemValue() (common.RegionalDistribution_FieldPathArrayItemValue, bool) { 2887 res, ok := fpaivs.subPathItemValue.(common.RegionalDistribution_FieldPathArrayItemValue) 2888 return res, ok 2889 } 2890 2891 // Contains returns a boolean indicating if value that is being held is present in given 'Assign' 2892 func (fpaivs *PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_RequestType_Assign) bool { 2893 switch fpaivs.Selector() { 2894 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2895 return false // repeated/map field 2896 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2897 return false // repeated/map field 2898 default: 2899 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Assign: %d", fpaivs.Selector())) 2900 } 2901 } 2902 2903 // PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues allows storing slice of values for Assign fields according to their type 2904 type PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues interface { 2905 gotenobject.FieldPathArrayOfValues 2906 PlanAssignmentRequestRequestTypeAssign_FieldPath 2907 } 2908 2909 func ParsePlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues(pathStr, valuesStr string) (PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues, error) { 2910 fp, err := ParsePlanAssignmentRequestRequestTypeAssign_FieldPath(pathStr) 2911 if err != nil { 2912 return nil, err 2913 } 2914 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2915 if err != nil { 2916 return nil, status.Errorf(codes.InvalidArgument, "error parsing Assign field path array of values from %s: %v", valuesStr, err) 2917 } 2918 return fpaov.(PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues), nil 2919 } 2920 2921 func MustParsePlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues(pathStr, valuesStr string) PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues { 2922 fpaov, err := ParsePlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues(pathStr, valuesStr) 2923 if err != nil { 2924 panic(err) 2925 } 2926 return fpaov 2927 } 2928 2929 type PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues struct { 2930 PlanAssignmentRequestRequestTypeAssign_FieldTerminalPath 2931 values interface{} 2932 } 2933 2934 var _ PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues = (*PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues)(nil) 2935 2936 func (fpaov *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2937 switch fpaov.selector { 2938 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorPlan: 2939 for _, v := range fpaov.values.([]*plan.Reference) { 2940 values = append(values, v) 2941 } 2942 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorExtensions: 2943 for _, v := range fpaov.values.([][]*common.Allowance) { 2944 values = append(values, v) 2945 } 2946 case PlanAssignmentRequestRequestTypeAssign_FieldPathSelectorRegionalDistributions: 2947 for _, v := range fpaov.values.([][]*common.RegionalDistribution) { 2948 values = append(values, v) 2949 } 2950 } 2951 return 2952 } 2953 func (fpaov *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues) AsPlanArrayOfValues() ([]*plan.Reference, bool) { 2954 res, ok := fpaov.values.([]*plan.Reference) 2955 return res, ok 2956 } 2957 func (fpaov *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues) AsExtensionsArrayOfValues() ([][]*common.Allowance, bool) { 2958 res, ok := fpaov.values.([][]*common.Allowance) 2959 return res, ok 2960 } 2961 func (fpaov *PlanAssignmentRequestRequestTypeAssign_FieldTerminalPathArrayOfValues) AsRegionalDistributionsArrayOfValues() ([][]*common.RegionalDistribution, bool) { 2962 res, ok := fpaov.values.([][]*common.RegionalDistribution) 2963 return res, ok 2964 } 2965 2966 type PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayOfValues struct { 2967 PlanAssignmentRequestRequestTypeAssign_FieldPath 2968 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 2969 } 2970 2971 var _ PlanAssignmentRequestRequestTypeAssign_FieldPathArrayOfValues = (*PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayOfValues)(nil) 2972 2973 func (fpsaov *PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 2974 return fpsaov.subPathArrayOfValues.GetRawValues() 2975 } 2976 func (fpsaov *PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayOfValues) AsExtensionsPathArrayOfValues() (common.Allowance_FieldPathArrayOfValues, bool) { 2977 res, ok := fpsaov.subPathArrayOfValues.(common.Allowance_FieldPathArrayOfValues) 2978 return res, ok 2979 } 2980 func (fpsaov *PlanAssignmentRequestRequestTypeAssign_FieldSubPathArrayOfValues) AsRegionalDistributionsPathArrayOfValues() (common.RegionalDistribution_FieldPathArrayOfValues, bool) { 2981 res, ok := fpsaov.subPathArrayOfValues.(common.RegionalDistribution_FieldPathArrayOfValues) 2982 return res, ok 2983 } 2984 2985 // FieldPath provides implementation to handle 2986 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 2987 type PlanAssignmentRequestRequestTypeExtend_FieldPath interface { 2988 gotenobject.FieldPath 2989 Selector() PlanAssignmentRequestRequestTypeExtend_FieldPathSelector 2990 Get(source *PlanAssignmentRequest_RequestType_Extend) []interface{} 2991 GetSingle(source *PlanAssignmentRequest_RequestType_Extend) (interface{}, bool) 2992 ClearValue(item *PlanAssignmentRequest_RequestType_Extend) 2993 2994 // Those methods build corresponding PlanAssignmentRequestRequestTypeExtend_FieldPathValue 2995 // (or array of values) and holds passed value. Panics if injected type is incorrect. 2996 WithIValue(value interface{}) PlanAssignmentRequestRequestTypeExtend_FieldPathValue 2997 WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues 2998 WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue 2999 } 3000 3001 type PlanAssignmentRequestRequestTypeExtend_FieldPathSelector int32 3002 3003 const ( 3004 PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment PlanAssignmentRequestRequestTypeExtend_FieldPathSelector = 0 3005 PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions PlanAssignmentRequestRequestTypeExtend_FieldPathSelector = 1 3006 PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions PlanAssignmentRequestRequestTypeExtend_FieldPathSelector = 2 3007 ) 3008 3009 func (s PlanAssignmentRequestRequestTypeExtend_FieldPathSelector) String() string { 3010 switch s { 3011 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3012 return "assignment" 3013 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3014 return "additions" 3015 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3016 return "regional_distributions" 3017 default: 3018 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", s)) 3019 } 3020 } 3021 3022 func BuildPlanAssignmentRequestRequestTypeExtend_FieldPath(fp gotenobject.RawFieldPath) (PlanAssignmentRequestRequestTypeExtend_FieldPath, error) { 3023 if len(fp) == 0 { 3024 return nil, status.Error(codes.InvalidArgument, "empty field path for object PlanAssignmentRequest_RequestType_Extend") 3025 } 3026 if len(fp) == 1 { 3027 switch fp[0] { 3028 case "assignment": 3029 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath{selector: PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment}, nil 3030 case "additions": 3031 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath{selector: PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions}, nil 3032 case "regional_distributions", "regionalDistributions", "regional-distributions": 3033 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath{selector: PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions}, nil 3034 } 3035 } else { 3036 switch fp[0] { 3037 case "additions": 3038 if subpath, err := common.BuildAllowance_FieldPath(fp[1:]); err != nil { 3039 return nil, err 3040 } else { 3041 return &PlanAssignmentRequestRequestTypeExtend_FieldSubPath{selector: PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions, subPath: subpath}, nil 3042 } 3043 case "regional_distributions", "regionalDistributions", "regional-distributions": 3044 if subpath, err := common.BuildRegionalDistribution_FieldPath(fp[1:]); err != nil { 3045 return nil, err 3046 } else { 3047 return &PlanAssignmentRequestRequestTypeExtend_FieldSubPath{selector: PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions, subPath: subpath}, nil 3048 } 3049 } 3050 } 3051 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PlanAssignmentRequest_RequestType_Extend", fp) 3052 } 3053 3054 func ParsePlanAssignmentRequestRequestTypeExtend_FieldPath(rawField string) (PlanAssignmentRequestRequestTypeExtend_FieldPath, error) { 3055 fp, err := gotenobject.ParseRawFieldPath(rawField) 3056 if err != nil { 3057 return nil, err 3058 } 3059 return BuildPlanAssignmentRequestRequestTypeExtend_FieldPath(fp) 3060 } 3061 3062 func MustParsePlanAssignmentRequestRequestTypeExtend_FieldPath(rawField string) PlanAssignmentRequestRequestTypeExtend_FieldPath { 3063 fp, err := ParsePlanAssignmentRequestRequestTypeExtend_FieldPath(rawField) 3064 if err != nil { 3065 panic(err) 3066 } 3067 return fp 3068 } 3069 3070 type PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath struct { 3071 selector PlanAssignmentRequestRequestTypeExtend_FieldPathSelector 3072 } 3073 3074 var _ PlanAssignmentRequestRequestTypeExtend_FieldPath = (*PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath)(nil) 3075 3076 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) Selector() PlanAssignmentRequestRequestTypeExtend_FieldPathSelector { 3077 return fp.selector 3078 } 3079 3080 // String returns path representation in proto convention 3081 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) String() string { 3082 return fp.selector.String() 3083 } 3084 3085 // JSONString returns path representation is JSON convention 3086 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) JSONString() string { 3087 return strcase.ToLowerCamel(fp.String()) 3088 } 3089 3090 // Get returns all values pointed by specific field from source PlanAssignmentRequest_RequestType_Extend 3091 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) Get(source *PlanAssignmentRequest_RequestType_Extend) (values []interface{}) { 3092 if source != nil { 3093 switch fp.selector { 3094 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3095 if source.Assignment != nil { 3096 values = append(values, source.Assignment) 3097 } 3098 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3099 for _, value := range source.GetAdditions() { 3100 values = append(values, value) 3101 } 3102 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3103 for _, value := range source.GetRegionalDistributions() { 3104 values = append(values, value) 3105 } 3106 default: 3107 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fp.selector)) 3108 } 3109 } 3110 return 3111 } 3112 3113 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3114 return fp.Get(source.(*PlanAssignmentRequest_RequestType_Extend)) 3115 } 3116 3117 // GetSingle returns value pointed by specific field of from source PlanAssignmentRequest_RequestType_Extend 3118 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) GetSingle(source *PlanAssignmentRequest_RequestType_Extend) (interface{}, bool) { 3119 switch fp.selector { 3120 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3121 res := source.GetAssignment() 3122 return res, res != nil 3123 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3124 res := source.GetAdditions() 3125 return res, res != nil 3126 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3127 res := source.GetRegionalDistributions() 3128 return res, res != nil 3129 default: 3130 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fp.selector)) 3131 } 3132 } 3133 3134 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3135 return fp.GetSingle(source.(*PlanAssignmentRequest_RequestType_Extend)) 3136 } 3137 3138 // GetDefault returns a default value of the field type 3139 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) GetDefault() interface{} { 3140 switch fp.selector { 3141 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3142 return (*plan_assignment.Reference)(nil) 3143 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3144 return ([]*common.Allowance)(nil) 3145 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3146 return ([]*common.RegionalDistribution)(nil) 3147 default: 3148 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fp.selector)) 3149 } 3150 } 3151 3152 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) ClearValue(item *PlanAssignmentRequest_RequestType_Extend) { 3153 if item != nil { 3154 switch fp.selector { 3155 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3156 item.Assignment = nil 3157 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3158 item.Additions = nil 3159 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3160 item.RegionalDistributions = nil 3161 default: 3162 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fp.selector)) 3163 } 3164 } 3165 } 3166 3167 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3168 fp.ClearValue(item.(*PlanAssignmentRequest_RequestType_Extend)) 3169 } 3170 3171 // IsLeaf - whether field path is holds simple value 3172 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) IsLeaf() bool { 3173 return fp.selector == PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment 3174 } 3175 3176 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3177 return []gotenobject.FieldPath{fp} 3178 } 3179 3180 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) WithIValue(value interface{}) PlanAssignmentRequestRequestTypeExtend_FieldPathValue { 3181 switch fp.selector { 3182 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3183 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue{PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath: *fp, value: value.(*plan_assignment.Reference)} 3184 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3185 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue{PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath: *fp, value: value.([]*common.Allowance)} 3186 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3187 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue{PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath: *fp, value: value.([]*common.RegionalDistribution)} 3188 default: 3189 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fp.selector)) 3190 } 3191 } 3192 3193 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3194 return fp.WithIValue(value) 3195 } 3196 3197 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues { 3198 fpaov := &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath: *fp} 3199 switch fp.selector { 3200 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3201 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath: *fp, values: values.([]*plan_assignment.Reference)} 3202 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3203 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath: *fp, values: values.([][]*common.Allowance)} 3204 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3205 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath: *fp, values: values.([][]*common.RegionalDistribution)} 3206 default: 3207 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fp.selector)) 3208 } 3209 return fpaov 3210 } 3211 3212 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3213 return fp.WithIArrayOfValues(values) 3214 } 3215 3216 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue { 3217 switch fp.selector { 3218 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3219 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue{PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath: *fp, value: value.(*common.Allowance)} 3220 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3221 return &PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue{PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath: *fp, value: value.(*common.RegionalDistribution)} 3222 default: 3223 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fp.selector)) 3224 } 3225 } 3226 3227 func (fp *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3228 return fp.WithIArrayItemValue(value) 3229 } 3230 3231 type PlanAssignmentRequestRequestTypeExtend_FieldSubPath struct { 3232 selector PlanAssignmentRequestRequestTypeExtend_FieldPathSelector 3233 subPath gotenobject.FieldPath 3234 } 3235 3236 var _ PlanAssignmentRequestRequestTypeExtend_FieldPath = (*PlanAssignmentRequestRequestTypeExtend_FieldSubPath)(nil) 3237 3238 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) Selector() PlanAssignmentRequestRequestTypeExtend_FieldPathSelector { 3239 return fps.selector 3240 } 3241 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) AsAdditionsSubPath() (common.Allowance_FieldPath, bool) { 3242 res, ok := fps.subPath.(common.Allowance_FieldPath) 3243 return res, ok 3244 } 3245 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) AsRegionalDistributionsSubPath() (common.RegionalDistribution_FieldPath, bool) { 3246 res, ok := fps.subPath.(common.RegionalDistribution_FieldPath) 3247 return res, ok 3248 } 3249 3250 // String returns path representation in proto convention 3251 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) String() string { 3252 return fps.selector.String() + "." + fps.subPath.String() 3253 } 3254 3255 // JSONString returns path representation is JSON convention 3256 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) JSONString() string { 3257 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 3258 } 3259 3260 // Get returns all values pointed by selected field from source PlanAssignmentRequest_RequestType_Extend 3261 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) Get(source *PlanAssignmentRequest_RequestType_Extend) (values []interface{}) { 3262 switch fps.selector { 3263 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3264 for _, item := range source.GetAdditions() { 3265 values = append(values, fps.subPath.GetRaw(item)...) 3266 } 3267 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3268 for _, item := range source.GetRegionalDistributions() { 3269 values = append(values, fps.subPath.GetRaw(item)...) 3270 } 3271 default: 3272 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fps.selector)) 3273 } 3274 return 3275 } 3276 3277 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) GetRaw(source proto.Message) []interface{} { 3278 return fps.Get(source.(*PlanAssignmentRequest_RequestType_Extend)) 3279 } 3280 3281 // GetSingle returns value of selected field from source PlanAssignmentRequest_RequestType_Extend 3282 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) GetSingle(source *PlanAssignmentRequest_RequestType_Extend) (interface{}, bool) { 3283 switch fps.selector { 3284 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3285 if len(source.GetAdditions()) == 0 { 3286 return nil, false 3287 } 3288 return fps.subPath.GetSingleRaw(source.GetAdditions()[0]) 3289 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3290 if len(source.GetRegionalDistributions()) == 0 { 3291 return nil, false 3292 } 3293 return fps.subPath.GetSingleRaw(source.GetRegionalDistributions()[0]) 3294 default: 3295 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fps.selector)) 3296 } 3297 } 3298 3299 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3300 return fps.GetSingle(source.(*PlanAssignmentRequest_RequestType_Extend)) 3301 } 3302 3303 // GetDefault returns a default value of the field type 3304 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) GetDefault() interface{} { 3305 return fps.subPath.GetDefault() 3306 } 3307 3308 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) ClearValue(item *PlanAssignmentRequest_RequestType_Extend) { 3309 if item != nil { 3310 switch fps.selector { 3311 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3312 for _, subItem := range item.Additions { 3313 fps.subPath.ClearValueRaw(subItem) 3314 } 3315 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3316 for _, subItem := range item.RegionalDistributions { 3317 fps.subPath.ClearValueRaw(subItem) 3318 } 3319 default: 3320 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fps.selector)) 3321 } 3322 } 3323 } 3324 3325 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) ClearValueRaw(item proto.Message) { 3326 fps.ClearValue(item.(*PlanAssignmentRequest_RequestType_Extend)) 3327 } 3328 3329 // IsLeaf - whether field path is holds simple value 3330 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) IsLeaf() bool { 3331 return fps.subPath.IsLeaf() 3332 } 3333 3334 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3335 iPaths := []gotenobject.FieldPath{&PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath{selector: fps.selector}} 3336 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 3337 return iPaths 3338 } 3339 3340 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) WithIValue(value interface{}) PlanAssignmentRequestRequestTypeExtend_FieldPathValue { 3341 return &PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 3342 } 3343 3344 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3345 return fps.WithIValue(value) 3346 } 3347 3348 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues { 3349 return &PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 3350 } 3351 3352 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3353 return fps.WithIArrayOfValues(values) 3354 } 3355 3356 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue { 3357 return &PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 3358 } 3359 3360 func (fps *PlanAssignmentRequestRequestTypeExtend_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3361 return fps.WithIArrayItemValue(value) 3362 } 3363 3364 // PlanAssignmentRequestRequestTypeExtend_FieldPathValue allows storing values for Extend fields according to their type 3365 type PlanAssignmentRequestRequestTypeExtend_FieldPathValue interface { 3366 PlanAssignmentRequestRequestTypeExtend_FieldPath 3367 gotenobject.FieldPathValue 3368 SetTo(target **PlanAssignmentRequest_RequestType_Extend) 3369 CompareWith(*PlanAssignmentRequest_RequestType_Extend) (cmp int, comparable bool) 3370 } 3371 3372 func ParsePlanAssignmentRequestRequestTypeExtend_FieldPathValue(pathStr, valueStr string) (PlanAssignmentRequestRequestTypeExtend_FieldPathValue, error) { 3373 fp, err := ParsePlanAssignmentRequestRequestTypeExtend_FieldPath(pathStr) 3374 if err != nil { 3375 return nil, err 3376 } 3377 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 3378 if err != nil { 3379 return nil, status.Errorf(codes.InvalidArgument, "error parsing Extend field path value from %s: %v", valueStr, err) 3380 } 3381 return fpv.(PlanAssignmentRequestRequestTypeExtend_FieldPathValue), nil 3382 } 3383 3384 func MustParsePlanAssignmentRequestRequestTypeExtend_FieldPathValue(pathStr, valueStr string) PlanAssignmentRequestRequestTypeExtend_FieldPathValue { 3385 fpv, err := ParsePlanAssignmentRequestRequestTypeExtend_FieldPathValue(pathStr, valueStr) 3386 if err != nil { 3387 panic(err) 3388 } 3389 return fpv 3390 } 3391 3392 type PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue struct { 3393 PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath 3394 value interface{} 3395 } 3396 3397 var _ PlanAssignmentRequestRequestTypeExtend_FieldPathValue = (*PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue)(nil) 3398 3399 // GetRawValue returns raw value stored under selected path for 'Extend' as interface{} 3400 func (fpv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue) GetRawValue() interface{} { 3401 return fpv.value 3402 } 3403 func (fpv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue) AsAssignmentValue() (*plan_assignment.Reference, bool) { 3404 res, ok := fpv.value.(*plan_assignment.Reference) 3405 return res, ok 3406 } 3407 func (fpv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue) AsAdditionsValue() ([]*common.Allowance, bool) { 3408 res, ok := fpv.value.([]*common.Allowance) 3409 return res, ok 3410 } 3411 func (fpv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue) AsRegionalDistributionsValue() ([]*common.RegionalDistribution, bool) { 3412 res, ok := fpv.value.([]*common.RegionalDistribution) 3413 return res, ok 3414 } 3415 3416 // SetTo stores value for selected field for object Extend 3417 func (fpv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue) SetTo(target **PlanAssignmentRequest_RequestType_Extend) { 3418 if *target == nil { 3419 *target = new(PlanAssignmentRequest_RequestType_Extend) 3420 } 3421 switch fpv.selector { 3422 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3423 (*target).Assignment = fpv.value.(*plan_assignment.Reference) 3424 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3425 (*target).Additions = fpv.value.([]*common.Allowance) 3426 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3427 (*target).RegionalDistributions = fpv.value.([]*common.RegionalDistribution) 3428 default: 3429 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fpv.selector)) 3430 } 3431 } 3432 3433 func (fpv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue) SetToRaw(target proto.Message) { 3434 typedObject := target.(*PlanAssignmentRequest_RequestType_Extend) 3435 fpv.SetTo(&typedObject) 3436 } 3437 3438 // CompareWith compares value in the 'PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue' with the value under path in 'PlanAssignmentRequest_RequestType_Extend'. 3439 func (fpv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue) CompareWith(source *PlanAssignmentRequest_RequestType_Extend) (int, bool) { 3440 switch fpv.selector { 3441 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3442 leftValue := fpv.value.(*plan_assignment.Reference) 3443 rightValue := source.GetAssignment() 3444 if leftValue == nil { 3445 if rightValue != nil { 3446 return -1, true 3447 } 3448 return 0, true 3449 } 3450 if rightValue == nil { 3451 return 1, true 3452 } 3453 if leftValue.String() == rightValue.String() { 3454 return 0, true 3455 } else if leftValue.String() < rightValue.String() { 3456 return -1, true 3457 } else { 3458 return 1, true 3459 } 3460 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3461 return 0, false 3462 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3463 return 0, false 3464 default: 3465 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fpv.selector)) 3466 } 3467 } 3468 3469 func (fpv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3470 return fpv.CompareWith(source.(*PlanAssignmentRequest_RequestType_Extend)) 3471 } 3472 3473 type PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue struct { 3474 PlanAssignmentRequestRequestTypeExtend_FieldPath 3475 subPathValue gotenobject.FieldPathValue 3476 } 3477 3478 var _ PlanAssignmentRequestRequestTypeExtend_FieldPathValue = (*PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue)(nil) 3479 3480 func (fpvs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue) AsAdditionsPathValue() (common.Allowance_FieldPathValue, bool) { 3481 res, ok := fpvs.subPathValue.(common.Allowance_FieldPathValue) 3482 return res, ok 3483 } 3484 func (fpvs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue) AsRegionalDistributionsPathValue() (common.RegionalDistribution_FieldPathValue, bool) { 3485 res, ok := fpvs.subPathValue.(common.RegionalDistribution_FieldPathValue) 3486 return res, ok 3487 } 3488 3489 func (fpvs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue) SetTo(target **PlanAssignmentRequest_RequestType_Extend) { 3490 if *target == nil { 3491 *target = new(PlanAssignmentRequest_RequestType_Extend) 3492 } 3493 switch fpvs.Selector() { 3494 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3495 panic("FieldPath setter is unsupported for array subpaths") 3496 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3497 panic("FieldPath setter is unsupported for array subpaths") 3498 default: 3499 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fpvs.Selector())) 3500 } 3501 } 3502 3503 func (fpvs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue) SetToRaw(target proto.Message) { 3504 typedObject := target.(*PlanAssignmentRequest_RequestType_Extend) 3505 fpvs.SetTo(&typedObject) 3506 } 3507 3508 func (fpvs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue) GetRawValue() interface{} { 3509 return fpvs.subPathValue.GetRawValue() 3510 } 3511 3512 func (fpvs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue) CompareWith(source *PlanAssignmentRequest_RequestType_Extend) (int, bool) { 3513 switch fpvs.Selector() { 3514 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3515 return 0, false // repeated field 3516 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3517 return 0, false // repeated field 3518 default: 3519 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fpvs.Selector())) 3520 } 3521 } 3522 3523 func (fpvs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 3524 return fpvs.CompareWith(source.(*PlanAssignmentRequest_RequestType_Extend)) 3525 } 3526 3527 // PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue allows storing single item in Path-specific values for Extend according to their type 3528 // Present only for array (repeated) types. 3529 type PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue interface { 3530 gotenobject.FieldPathArrayItemValue 3531 PlanAssignmentRequestRequestTypeExtend_FieldPath 3532 ContainsValue(*PlanAssignmentRequest_RequestType_Extend) bool 3533 } 3534 3535 // ParsePlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 3536 func ParsePlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue(pathStr, valueStr string) (PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue, error) { 3537 fp, err := ParsePlanAssignmentRequestRequestTypeExtend_FieldPath(pathStr) 3538 if err != nil { 3539 return nil, err 3540 } 3541 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 3542 if err != nil { 3543 return nil, status.Errorf(codes.InvalidArgument, "error parsing Extend field path array item value from %s: %v", valueStr, err) 3544 } 3545 return fpaiv.(PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue), nil 3546 } 3547 3548 func MustParsePlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue(pathStr, valueStr string) PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue { 3549 fpaiv, err := ParsePlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue(pathStr, valueStr) 3550 if err != nil { 3551 panic(err) 3552 } 3553 return fpaiv 3554 } 3555 3556 type PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue struct { 3557 PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath 3558 value interface{} 3559 } 3560 3561 var _ PlanAssignmentRequestRequestTypeExtend_FieldPathArrayItemValue = (*PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue)(nil) 3562 3563 // GetRawValue returns stored element value for array in object PlanAssignmentRequest_RequestType_Extend as interface{} 3564 func (fpaiv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 3565 return fpaiv.value 3566 } 3567 func (fpaiv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue) AsAdditionsItemValue() (*common.Allowance, bool) { 3568 res, ok := fpaiv.value.(*common.Allowance) 3569 return res, ok 3570 } 3571 func (fpaiv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue) AsRegionalDistributionsItemValue() (*common.RegionalDistribution, bool) { 3572 res, ok := fpaiv.value.(*common.RegionalDistribution) 3573 return res, ok 3574 } 3575 3576 func (fpaiv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue) GetSingle(source *PlanAssignmentRequest_RequestType_Extend) (interface{}, bool) { 3577 return nil, false 3578 } 3579 3580 func (fpaiv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 3581 return fpaiv.GetSingle(source.(*PlanAssignmentRequest_RequestType_Extend)) 3582 } 3583 3584 // Contains returns a boolean indicating if value that is being held is present in given 'Extend' 3585 func (fpaiv *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_RequestType_Extend) bool { 3586 slice := fpaiv.PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath.Get(source) 3587 for _, v := range slice { 3588 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 3589 if proto.Equal(asProtoMsg, v.(proto.Message)) { 3590 return true 3591 } 3592 } else if reflect.DeepEqual(v, fpaiv.value) { 3593 return true 3594 } 3595 } 3596 return false 3597 } 3598 3599 type PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayItemValue struct { 3600 PlanAssignmentRequestRequestTypeExtend_FieldPath 3601 subPathItemValue gotenobject.FieldPathArrayItemValue 3602 } 3603 3604 // GetRawValue returns stored array item value 3605 func (fpaivs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 3606 return fpaivs.subPathItemValue.GetRawItemValue() 3607 } 3608 func (fpaivs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayItemValue) AsAdditionsPathItemValue() (common.Allowance_FieldPathArrayItemValue, bool) { 3609 res, ok := fpaivs.subPathItemValue.(common.Allowance_FieldPathArrayItemValue) 3610 return res, ok 3611 } 3612 func (fpaivs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayItemValue) AsRegionalDistributionsPathItemValue() (common.RegionalDistribution_FieldPathArrayItemValue, bool) { 3613 res, ok := fpaivs.subPathItemValue.(common.RegionalDistribution_FieldPathArrayItemValue) 3614 return res, ok 3615 } 3616 3617 // Contains returns a boolean indicating if value that is being held is present in given 'Extend' 3618 func (fpaivs *PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_RequestType_Extend) bool { 3619 switch fpaivs.Selector() { 3620 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3621 return false // repeated/map field 3622 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3623 return false // repeated/map field 3624 default: 3625 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Extend: %d", fpaivs.Selector())) 3626 } 3627 } 3628 3629 // PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues allows storing slice of values for Extend fields according to their type 3630 type PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues interface { 3631 gotenobject.FieldPathArrayOfValues 3632 PlanAssignmentRequestRequestTypeExtend_FieldPath 3633 } 3634 3635 func ParsePlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues(pathStr, valuesStr string) (PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues, error) { 3636 fp, err := ParsePlanAssignmentRequestRequestTypeExtend_FieldPath(pathStr) 3637 if err != nil { 3638 return nil, err 3639 } 3640 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 3641 if err != nil { 3642 return nil, status.Errorf(codes.InvalidArgument, "error parsing Extend field path array of values from %s: %v", valuesStr, err) 3643 } 3644 return fpaov.(PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues), nil 3645 } 3646 3647 func MustParsePlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues(pathStr, valuesStr string) PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues { 3648 fpaov, err := ParsePlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues(pathStr, valuesStr) 3649 if err != nil { 3650 panic(err) 3651 } 3652 return fpaov 3653 } 3654 3655 type PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues struct { 3656 PlanAssignmentRequestRequestTypeExtend_FieldTerminalPath 3657 values interface{} 3658 } 3659 3660 var _ PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues = (*PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues)(nil) 3661 3662 func (fpaov *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 3663 switch fpaov.selector { 3664 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAssignment: 3665 for _, v := range fpaov.values.([]*plan_assignment.Reference) { 3666 values = append(values, v) 3667 } 3668 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorAdditions: 3669 for _, v := range fpaov.values.([][]*common.Allowance) { 3670 values = append(values, v) 3671 } 3672 case PlanAssignmentRequestRequestTypeExtend_FieldPathSelectorRegionalDistributions: 3673 for _, v := range fpaov.values.([][]*common.RegionalDistribution) { 3674 values = append(values, v) 3675 } 3676 } 3677 return 3678 } 3679 func (fpaov *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues) AsAssignmentArrayOfValues() ([]*plan_assignment.Reference, bool) { 3680 res, ok := fpaov.values.([]*plan_assignment.Reference) 3681 return res, ok 3682 } 3683 func (fpaov *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues) AsAdditionsArrayOfValues() ([][]*common.Allowance, bool) { 3684 res, ok := fpaov.values.([][]*common.Allowance) 3685 return res, ok 3686 } 3687 func (fpaov *PlanAssignmentRequestRequestTypeExtend_FieldTerminalPathArrayOfValues) AsRegionalDistributionsArrayOfValues() ([][]*common.RegionalDistribution, bool) { 3688 res, ok := fpaov.values.([][]*common.RegionalDistribution) 3689 return res, ok 3690 } 3691 3692 type PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayOfValues struct { 3693 PlanAssignmentRequestRequestTypeExtend_FieldPath 3694 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 3695 } 3696 3697 var _ PlanAssignmentRequestRequestTypeExtend_FieldPathArrayOfValues = (*PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayOfValues)(nil) 3698 3699 func (fpsaov *PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 3700 return fpsaov.subPathArrayOfValues.GetRawValues() 3701 } 3702 func (fpsaov *PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayOfValues) AsAdditionsPathArrayOfValues() (common.Allowance_FieldPathArrayOfValues, bool) { 3703 res, ok := fpsaov.subPathArrayOfValues.(common.Allowance_FieldPathArrayOfValues) 3704 return res, ok 3705 } 3706 func (fpsaov *PlanAssignmentRequestRequestTypeExtend_FieldSubPathArrayOfValues) AsRegionalDistributionsPathArrayOfValues() (common.RegionalDistribution_FieldPathArrayOfValues, bool) { 3707 res, ok := fpsaov.subPathArrayOfValues.(common.RegionalDistribution_FieldPathArrayOfValues) 3708 return res, ok 3709 } 3710 3711 // FieldPath provides implementation to handle 3712 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 3713 type PlanAssignmentRequestRequestTypeRedistribute_FieldPath interface { 3714 gotenobject.FieldPath 3715 Selector() PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelector 3716 Get(source *PlanAssignmentRequest_RequestType_Redistribute) []interface{} 3717 GetSingle(source *PlanAssignmentRequest_RequestType_Redistribute) (interface{}, bool) 3718 ClearValue(item *PlanAssignmentRequest_RequestType_Redistribute) 3719 3720 // Those methods build corresponding PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue 3721 // (or array of values) and holds passed value. Panics if injected type is incorrect. 3722 WithIValue(value interface{}) PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue 3723 WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues 3724 WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue 3725 } 3726 3727 type PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelector int32 3728 3729 const ( 3730 PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelector = 0 3731 PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelector = 1 3732 ) 3733 3734 func (s PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelector) String() string { 3735 switch s { 3736 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 3737 return "assignment" 3738 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3739 return "regional_distributions" 3740 default: 3741 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", s)) 3742 } 3743 } 3744 3745 func BuildPlanAssignmentRequestRequestTypeRedistribute_FieldPath(fp gotenobject.RawFieldPath) (PlanAssignmentRequestRequestTypeRedistribute_FieldPath, error) { 3746 if len(fp) == 0 { 3747 return nil, status.Error(codes.InvalidArgument, "empty field path for object PlanAssignmentRequest_RequestType_Redistribute") 3748 } 3749 if len(fp) == 1 { 3750 switch fp[0] { 3751 case "assignment": 3752 return &PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath{selector: PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment}, nil 3753 case "regional_distributions", "regionalDistributions", "regional-distributions": 3754 return &PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath{selector: PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions}, nil 3755 } 3756 } else { 3757 switch fp[0] { 3758 case "regional_distributions", "regionalDistributions", "regional-distributions": 3759 if subpath, err := common.BuildRegionalDistribution_FieldPath(fp[1:]); err != nil { 3760 return nil, err 3761 } else { 3762 return &PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath{selector: PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions, subPath: subpath}, nil 3763 } 3764 } 3765 } 3766 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PlanAssignmentRequest_RequestType_Redistribute", fp) 3767 } 3768 3769 func ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPath(rawField string) (PlanAssignmentRequestRequestTypeRedistribute_FieldPath, error) { 3770 fp, err := gotenobject.ParseRawFieldPath(rawField) 3771 if err != nil { 3772 return nil, err 3773 } 3774 return BuildPlanAssignmentRequestRequestTypeRedistribute_FieldPath(fp) 3775 } 3776 3777 func MustParsePlanAssignmentRequestRequestTypeRedistribute_FieldPath(rawField string) PlanAssignmentRequestRequestTypeRedistribute_FieldPath { 3778 fp, err := ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPath(rawField) 3779 if err != nil { 3780 panic(err) 3781 } 3782 return fp 3783 } 3784 3785 type PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath struct { 3786 selector PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelector 3787 } 3788 3789 var _ PlanAssignmentRequestRequestTypeRedistribute_FieldPath = (*PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath)(nil) 3790 3791 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) Selector() PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelector { 3792 return fp.selector 3793 } 3794 3795 // String returns path representation in proto convention 3796 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) String() string { 3797 return fp.selector.String() 3798 } 3799 3800 // JSONString returns path representation is JSON convention 3801 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) JSONString() string { 3802 return strcase.ToLowerCamel(fp.String()) 3803 } 3804 3805 // Get returns all values pointed by specific field from source PlanAssignmentRequest_RequestType_Redistribute 3806 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) Get(source *PlanAssignmentRequest_RequestType_Redistribute) (values []interface{}) { 3807 if source != nil { 3808 switch fp.selector { 3809 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 3810 if source.Assignment != nil { 3811 values = append(values, source.Assignment) 3812 } 3813 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3814 for _, value := range source.GetRegionalDistributions() { 3815 values = append(values, value) 3816 } 3817 default: 3818 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fp.selector)) 3819 } 3820 } 3821 return 3822 } 3823 3824 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 3825 return fp.Get(source.(*PlanAssignmentRequest_RequestType_Redistribute)) 3826 } 3827 3828 // GetSingle returns value pointed by specific field of from source PlanAssignmentRequest_RequestType_Redistribute 3829 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) GetSingle(source *PlanAssignmentRequest_RequestType_Redistribute) (interface{}, bool) { 3830 switch fp.selector { 3831 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 3832 res := source.GetAssignment() 3833 return res, res != nil 3834 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3835 res := source.GetRegionalDistributions() 3836 return res, res != nil 3837 default: 3838 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fp.selector)) 3839 } 3840 } 3841 3842 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3843 return fp.GetSingle(source.(*PlanAssignmentRequest_RequestType_Redistribute)) 3844 } 3845 3846 // GetDefault returns a default value of the field type 3847 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) GetDefault() interface{} { 3848 switch fp.selector { 3849 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 3850 return (*plan_assignment.Reference)(nil) 3851 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3852 return ([]*common.RegionalDistribution)(nil) 3853 default: 3854 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fp.selector)) 3855 } 3856 } 3857 3858 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) ClearValue(item *PlanAssignmentRequest_RequestType_Redistribute) { 3859 if item != nil { 3860 switch fp.selector { 3861 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 3862 item.Assignment = nil 3863 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3864 item.RegionalDistributions = nil 3865 default: 3866 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fp.selector)) 3867 } 3868 } 3869 } 3870 3871 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) ClearValueRaw(item proto.Message) { 3872 fp.ClearValue(item.(*PlanAssignmentRequest_RequestType_Redistribute)) 3873 } 3874 3875 // IsLeaf - whether field path is holds simple value 3876 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) IsLeaf() bool { 3877 return fp.selector == PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment 3878 } 3879 3880 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 3881 return []gotenobject.FieldPath{fp} 3882 } 3883 3884 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) WithIValue(value interface{}) PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue { 3885 switch fp.selector { 3886 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 3887 return &PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue{PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath: *fp, value: value.(*plan_assignment.Reference)} 3888 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3889 return &PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue{PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath: *fp, value: value.([]*common.RegionalDistribution)} 3890 default: 3891 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fp.selector)) 3892 } 3893 } 3894 3895 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 3896 return fp.WithIValue(value) 3897 } 3898 3899 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues { 3900 fpaov := &PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath: *fp} 3901 switch fp.selector { 3902 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 3903 return &PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath: *fp, values: values.([]*plan_assignment.Reference)} 3904 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3905 return &PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath: *fp, values: values.([][]*common.RegionalDistribution)} 3906 default: 3907 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fp.selector)) 3908 } 3909 return fpaov 3910 } 3911 3912 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 3913 return fp.WithIArrayOfValues(values) 3914 } 3915 3916 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue { 3917 switch fp.selector { 3918 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3919 return &PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayItemValue{PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath: *fp, value: value.(*common.RegionalDistribution)} 3920 default: 3921 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fp.selector)) 3922 } 3923 } 3924 3925 func (fp *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 3926 return fp.WithIArrayItemValue(value) 3927 } 3928 3929 type PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath struct { 3930 selector PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelector 3931 subPath gotenobject.FieldPath 3932 } 3933 3934 var _ PlanAssignmentRequestRequestTypeRedistribute_FieldPath = (*PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath)(nil) 3935 3936 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) Selector() PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelector { 3937 return fps.selector 3938 } 3939 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) AsRegionalDistributionsSubPath() (common.RegionalDistribution_FieldPath, bool) { 3940 res, ok := fps.subPath.(common.RegionalDistribution_FieldPath) 3941 return res, ok 3942 } 3943 3944 // String returns path representation in proto convention 3945 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) String() string { 3946 return fps.selector.String() + "." + fps.subPath.String() 3947 } 3948 3949 // JSONString returns path representation is JSON convention 3950 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) JSONString() string { 3951 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 3952 } 3953 3954 // Get returns all values pointed by selected field from source PlanAssignmentRequest_RequestType_Redistribute 3955 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) Get(source *PlanAssignmentRequest_RequestType_Redistribute) (values []interface{}) { 3956 switch fps.selector { 3957 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3958 for _, item := range source.GetRegionalDistributions() { 3959 values = append(values, fps.subPath.GetRaw(item)...) 3960 } 3961 default: 3962 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fps.selector)) 3963 } 3964 return 3965 } 3966 3967 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) GetRaw(source proto.Message) []interface{} { 3968 return fps.Get(source.(*PlanAssignmentRequest_RequestType_Redistribute)) 3969 } 3970 3971 // GetSingle returns value of selected field from source PlanAssignmentRequest_RequestType_Redistribute 3972 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) GetSingle(source *PlanAssignmentRequest_RequestType_Redistribute) (interface{}, bool) { 3973 switch fps.selector { 3974 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3975 if len(source.GetRegionalDistributions()) == 0 { 3976 return nil, false 3977 } 3978 return fps.subPath.GetSingleRaw(source.GetRegionalDistributions()[0]) 3979 default: 3980 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fps.selector)) 3981 } 3982 } 3983 3984 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 3985 return fps.GetSingle(source.(*PlanAssignmentRequest_RequestType_Redistribute)) 3986 } 3987 3988 // GetDefault returns a default value of the field type 3989 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) GetDefault() interface{} { 3990 return fps.subPath.GetDefault() 3991 } 3992 3993 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) ClearValue(item *PlanAssignmentRequest_RequestType_Redistribute) { 3994 if item != nil { 3995 switch fps.selector { 3996 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 3997 for _, subItem := range item.RegionalDistributions { 3998 fps.subPath.ClearValueRaw(subItem) 3999 } 4000 default: 4001 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fps.selector)) 4002 } 4003 } 4004 } 4005 4006 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) ClearValueRaw(item proto.Message) { 4007 fps.ClearValue(item.(*PlanAssignmentRequest_RequestType_Redistribute)) 4008 } 4009 4010 // IsLeaf - whether field path is holds simple value 4011 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) IsLeaf() bool { 4012 return fps.subPath.IsLeaf() 4013 } 4014 4015 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4016 iPaths := []gotenobject.FieldPath{&PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath{selector: fps.selector}} 4017 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 4018 return iPaths 4019 } 4020 4021 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) WithIValue(value interface{}) PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue { 4022 return &PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 4023 } 4024 4025 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4026 return fps.WithIValue(value) 4027 } 4028 4029 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues { 4030 return &PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 4031 } 4032 4033 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4034 return fps.WithIArrayOfValues(values) 4035 } 4036 4037 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue { 4038 return &PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 4039 } 4040 4041 func (fps *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4042 return fps.WithIArrayItemValue(value) 4043 } 4044 4045 // PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue allows storing values for Redistribute fields according to their type 4046 type PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue interface { 4047 PlanAssignmentRequestRequestTypeRedistribute_FieldPath 4048 gotenobject.FieldPathValue 4049 SetTo(target **PlanAssignmentRequest_RequestType_Redistribute) 4050 CompareWith(*PlanAssignmentRequest_RequestType_Redistribute) (cmp int, comparable bool) 4051 } 4052 4053 func ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathValue(pathStr, valueStr string) (PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue, error) { 4054 fp, err := ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPath(pathStr) 4055 if err != nil { 4056 return nil, err 4057 } 4058 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4059 if err != nil { 4060 return nil, status.Errorf(codes.InvalidArgument, "error parsing Redistribute field path value from %s: %v", valueStr, err) 4061 } 4062 return fpv.(PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue), nil 4063 } 4064 4065 func MustParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathValue(pathStr, valueStr string) PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue { 4066 fpv, err := ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathValue(pathStr, valueStr) 4067 if err != nil { 4068 panic(err) 4069 } 4070 return fpv 4071 } 4072 4073 type PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue struct { 4074 PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath 4075 value interface{} 4076 } 4077 4078 var _ PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue = (*PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue)(nil) 4079 4080 // GetRawValue returns raw value stored under selected path for 'Redistribute' as interface{} 4081 func (fpv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue) GetRawValue() interface{} { 4082 return fpv.value 4083 } 4084 func (fpv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue) AsAssignmentValue() (*plan_assignment.Reference, bool) { 4085 res, ok := fpv.value.(*plan_assignment.Reference) 4086 return res, ok 4087 } 4088 func (fpv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue) AsRegionalDistributionsValue() ([]*common.RegionalDistribution, bool) { 4089 res, ok := fpv.value.([]*common.RegionalDistribution) 4090 return res, ok 4091 } 4092 4093 // SetTo stores value for selected field for object Redistribute 4094 func (fpv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue) SetTo(target **PlanAssignmentRequest_RequestType_Redistribute) { 4095 if *target == nil { 4096 *target = new(PlanAssignmentRequest_RequestType_Redistribute) 4097 } 4098 switch fpv.selector { 4099 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 4100 (*target).Assignment = fpv.value.(*plan_assignment.Reference) 4101 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 4102 (*target).RegionalDistributions = fpv.value.([]*common.RegionalDistribution) 4103 default: 4104 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fpv.selector)) 4105 } 4106 } 4107 4108 func (fpv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4109 typedObject := target.(*PlanAssignmentRequest_RequestType_Redistribute) 4110 fpv.SetTo(&typedObject) 4111 } 4112 4113 // CompareWith compares value in the 'PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue' with the value under path in 'PlanAssignmentRequest_RequestType_Redistribute'. 4114 func (fpv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue) CompareWith(source *PlanAssignmentRequest_RequestType_Redistribute) (int, bool) { 4115 switch fpv.selector { 4116 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 4117 leftValue := fpv.value.(*plan_assignment.Reference) 4118 rightValue := source.GetAssignment() 4119 if leftValue == nil { 4120 if rightValue != nil { 4121 return -1, true 4122 } 4123 return 0, true 4124 } 4125 if rightValue == nil { 4126 return 1, true 4127 } 4128 if leftValue.String() == rightValue.String() { 4129 return 0, true 4130 } else if leftValue.String() < rightValue.String() { 4131 return -1, true 4132 } else { 4133 return 1, true 4134 } 4135 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 4136 return 0, false 4137 default: 4138 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fpv.selector)) 4139 } 4140 } 4141 4142 func (fpv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4143 return fpv.CompareWith(source.(*PlanAssignmentRequest_RequestType_Redistribute)) 4144 } 4145 4146 type PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathValue struct { 4147 PlanAssignmentRequestRequestTypeRedistribute_FieldPath 4148 subPathValue gotenobject.FieldPathValue 4149 } 4150 4151 var _ PlanAssignmentRequestRequestTypeRedistribute_FieldPathValue = (*PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathValue)(nil) 4152 4153 func (fpvs *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathValue) AsRegionalDistributionsPathValue() (common.RegionalDistribution_FieldPathValue, bool) { 4154 res, ok := fpvs.subPathValue.(common.RegionalDistribution_FieldPathValue) 4155 return res, ok 4156 } 4157 4158 func (fpvs *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathValue) SetTo(target **PlanAssignmentRequest_RequestType_Redistribute) { 4159 if *target == nil { 4160 *target = new(PlanAssignmentRequest_RequestType_Redistribute) 4161 } 4162 switch fpvs.Selector() { 4163 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 4164 panic("FieldPath setter is unsupported for array subpaths") 4165 default: 4166 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fpvs.Selector())) 4167 } 4168 } 4169 4170 func (fpvs *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathValue) SetToRaw(target proto.Message) { 4171 typedObject := target.(*PlanAssignmentRequest_RequestType_Redistribute) 4172 fpvs.SetTo(&typedObject) 4173 } 4174 4175 func (fpvs *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathValue) GetRawValue() interface{} { 4176 return fpvs.subPathValue.GetRawValue() 4177 } 4178 4179 func (fpvs *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathValue) CompareWith(source *PlanAssignmentRequest_RequestType_Redistribute) (int, bool) { 4180 switch fpvs.Selector() { 4181 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 4182 return 0, false // repeated field 4183 default: 4184 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fpvs.Selector())) 4185 } 4186 } 4187 4188 func (fpvs *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4189 return fpvs.CompareWith(source.(*PlanAssignmentRequest_RequestType_Redistribute)) 4190 } 4191 4192 // PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue allows storing single item in Path-specific values for Redistribute according to their type 4193 // Present only for array (repeated) types. 4194 type PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue interface { 4195 gotenobject.FieldPathArrayItemValue 4196 PlanAssignmentRequestRequestTypeRedistribute_FieldPath 4197 ContainsValue(*PlanAssignmentRequest_RequestType_Redistribute) bool 4198 } 4199 4200 // ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4201 func ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue(pathStr, valueStr string) (PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue, error) { 4202 fp, err := ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPath(pathStr) 4203 if err != nil { 4204 return nil, err 4205 } 4206 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4207 if err != nil { 4208 return nil, status.Errorf(codes.InvalidArgument, "error parsing Redistribute field path array item value from %s: %v", valueStr, err) 4209 } 4210 return fpaiv.(PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue), nil 4211 } 4212 4213 func MustParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue(pathStr, valueStr string) PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue { 4214 fpaiv, err := ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue(pathStr, valueStr) 4215 if err != nil { 4216 panic(err) 4217 } 4218 return fpaiv 4219 } 4220 4221 type PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayItemValue struct { 4222 PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath 4223 value interface{} 4224 } 4225 4226 var _ PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayItemValue = (*PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayItemValue)(nil) 4227 4228 // GetRawValue returns stored element value for array in object PlanAssignmentRequest_RequestType_Redistribute as interface{} 4229 func (fpaiv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4230 return fpaiv.value 4231 } 4232 func (fpaiv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayItemValue) AsRegionalDistributionsItemValue() (*common.RegionalDistribution, bool) { 4233 res, ok := fpaiv.value.(*common.RegionalDistribution) 4234 return res, ok 4235 } 4236 4237 func (fpaiv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayItemValue) GetSingle(source *PlanAssignmentRequest_RequestType_Redistribute) (interface{}, bool) { 4238 return nil, false 4239 } 4240 4241 func (fpaiv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4242 return fpaiv.GetSingle(source.(*PlanAssignmentRequest_RequestType_Redistribute)) 4243 } 4244 4245 // Contains returns a boolean indicating if value that is being held is present in given 'Redistribute' 4246 func (fpaiv *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_RequestType_Redistribute) bool { 4247 slice := fpaiv.PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath.Get(source) 4248 for _, v := range slice { 4249 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4250 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4251 return true 4252 } 4253 } else if reflect.DeepEqual(v, fpaiv.value) { 4254 return true 4255 } 4256 } 4257 return false 4258 } 4259 4260 type PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayItemValue struct { 4261 PlanAssignmentRequestRequestTypeRedistribute_FieldPath 4262 subPathItemValue gotenobject.FieldPathArrayItemValue 4263 } 4264 4265 // GetRawValue returns stored array item value 4266 func (fpaivs *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 4267 return fpaivs.subPathItemValue.GetRawItemValue() 4268 } 4269 func (fpaivs *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayItemValue) AsRegionalDistributionsPathItemValue() (common.RegionalDistribution_FieldPathArrayItemValue, bool) { 4270 res, ok := fpaivs.subPathItemValue.(common.RegionalDistribution_FieldPathArrayItemValue) 4271 return res, ok 4272 } 4273 4274 // Contains returns a boolean indicating if value that is being held is present in given 'Redistribute' 4275 func (fpaivs *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_RequestType_Redistribute) bool { 4276 switch fpaivs.Selector() { 4277 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 4278 return false // repeated/map field 4279 default: 4280 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Redistribute: %d", fpaivs.Selector())) 4281 } 4282 } 4283 4284 // PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues allows storing slice of values for Redistribute fields according to their type 4285 type PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues interface { 4286 gotenobject.FieldPathArrayOfValues 4287 PlanAssignmentRequestRequestTypeRedistribute_FieldPath 4288 } 4289 4290 func ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues(pathStr, valuesStr string) (PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues, error) { 4291 fp, err := ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPath(pathStr) 4292 if err != nil { 4293 return nil, err 4294 } 4295 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4296 if err != nil { 4297 return nil, status.Errorf(codes.InvalidArgument, "error parsing Redistribute field path array of values from %s: %v", valuesStr, err) 4298 } 4299 return fpaov.(PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues), nil 4300 } 4301 4302 func MustParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues(pathStr, valuesStr string) PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues { 4303 fpaov, err := ParsePlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues(pathStr, valuesStr) 4304 if err != nil { 4305 panic(err) 4306 } 4307 return fpaov 4308 } 4309 4310 type PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayOfValues struct { 4311 PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPath 4312 values interface{} 4313 } 4314 4315 var _ PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues = (*PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayOfValues)(nil) 4316 4317 func (fpaov *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4318 switch fpaov.selector { 4319 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorAssignment: 4320 for _, v := range fpaov.values.([]*plan_assignment.Reference) { 4321 values = append(values, v) 4322 } 4323 case PlanAssignmentRequestRequestTypeRedistribute_FieldPathSelectorRegionalDistributions: 4324 for _, v := range fpaov.values.([][]*common.RegionalDistribution) { 4325 values = append(values, v) 4326 } 4327 } 4328 return 4329 } 4330 func (fpaov *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayOfValues) AsAssignmentArrayOfValues() ([]*plan_assignment.Reference, bool) { 4331 res, ok := fpaov.values.([]*plan_assignment.Reference) 4332 return res, ok 4333 } 4334 func (fpaov *PlanAssignmentRequestRequestTypeRedistribute_FieldTerminalPathArrayOfValues) AsRegionalDistributionsArrayOfValues() ([][]*common.RegionalDistribution, bool) { 4335 res, ok := fpaov.values.([][]*common.RegionalDistribution) 4336 return res, ok 4337 } 4338 4339 type PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayOfValues struct { 4340 PlanAssignmentRequestRequestTypeRedistribute_FieldPath 4341 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 4342 } 4343 4344 var _ PlanAssignmentRequestRequestTypeRedistribute_FieldPathArrayOfValues = (*PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayOfValues)(nil) 4345 4346 func (fpsaov *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 4347 return fpsaov.subPathArrayOfValues.GetRawValues() 4348 } 4349 func (fpsaov *PlanAssignmentRequestRequestTypeRedistribute_FieldSubPathArrayOfValues) AsRegionalDistributionsPathArrayOfValues() (common.RegionalDistribution_FieldPathArrayOfValues, bool) { 4350 res, ok := fpsaov.subPathArrayOfValues.(common.RegionalDistribution_FieldPathArrayOfValues) 4351 return res, ok 4352 } 4353 4354 // FieldPath provides implementation to handle 4355 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 4356 type PlanAssignmentRequestRequestTypeUnassign_FieldPath interface { 4357 gotenobject.FieldPath 4358 Selector() PlanAssignmentRequestRequestTypeUnassign_FieldPathSelector 4359 Get(source *PlanAssignmentRequest_RequestType_Unassign) []interface{} 4360 GetSingle(source *PlanAssignmentRequest_RequestType_Unassign) (interface{}, bool) 4361 ClearValue(item *PlanAssignmentRequest_RequestType_Unassign) 4362 4363 // Those methods build corresponding PlanAssignmentRequestRequestTypeUnassign_FieldPathValue 4364 // (or array of values) and holds passed value. Panics if injected type is incorrect. 4365 WithIValue(value interface{}) PlanAssignmentRequestRequestTypeUnassign_FieldPathValue 4366 WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues 4367 WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue 4368 } 4369 4370 type PlanAssignmentRequestRequestTypeUnassign_FieldPathSelector int32 4371 4372 const ( 4373 PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment PlanAssignmentRequestRequestTypeUnassign_FieldPathSelector = 0 4374 ) 4375 4376 func (s PlanAssignmentRequestRequestTypeUnassign_FieldPathSelector) String() string { 4377 switch s { 4378 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4379 return "assignment" 4380 default: 4381 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", s)) 4382 } 4383 } 4384 4385 func BuildPlanAssignmentRequestRequestTypeUnassign_FieldPath(fp gotenobject.RawFieldPath) (PlanAssignmentRequestRequestTypeUnassign_FieldPath, error) { 4386 if len(fp) == 0 { 4387 return nil, status.Error(codes.InvalidArgument, "empty field path for object PlanAssignmentRequest_RequestType_Unassign") 4388 } 4389 if len(fp) == 1 { 4390 switch fp[0] { 4391 case "assignment": 4392 return &PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath{selector: PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment}, nil 4393 } 4394 } 4395 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object PlanAssignmentRequest_RequestType_Unassign", fp) 4396 } 4397 4398 func ParsePlanAssignmentRequestRequestTypeUnassign_FieldPath(rawField string) (PlanAssignmentRequestRequestTypeUnassign_FieldPath, error) { 4399 fp, err := gotenobject.ParseRawFieldPath(rawField) 4400 if err != nil { 4401 return nil, err 4402 } 4403 return BuildPlanAssignmentRequestRequestTypeUnassign_FieldPath(fp) 4404 } 4405 4406 func MustParsePlanAssignmentRequestRequestTypeUnassign_FieldPath(rawField string) PlanAssignmentRequestRequestTypeUnassign_FieldPath { 4407 fp, err := ParsePlanAssignmentRequestRequestTypeUnassign_FieldPath(rawField) 4408 if err != nil { 4409 panic(err) 4410 } 4411 return fp 4412 } 4413 4414 type PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath struct { 4415 selector PlanAssignmentRequestRequestTypeUnassign_FieldPathSelector 4416 } 4417 4418 var _ PlanAssignmentRequestRequestTypeUnassign_FieldPath = (*PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath)(nil) 4419 4420 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) Selector() PlanAssignmentRequestRequestTypeUnassign_FieldPathSelector { 4421 return fp.selector 4422 } 4423 4424 // String returns path representation in proto convention 4425 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) String() string { 4426 return fp.selector.String() 4427 } 4428 4429 // JSONString returns path representation is JSON convention 4430 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) JSONString() string { 4431 return strcase.ToLowerCamel(fp.String()) 4432 } 4433 4434 // Get returns all values pointed by specific field from source PlanAssignmentRequest_RequestType_Unassign 4435 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) Get(source *PlanAssignmentRequest_RequestType_Unassign) (values []interface{}) { 4436 if source != nil { 4437 switch fp.selector { 4438 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4439 if source.Assignment != nil { 4440 values = append(values, source.Assignment) 4441 } 4442 default: 4443 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", fp.selector)) 4444 } 4445 } 4446 return 4447 } 4448 4449 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 4450 return fp.Get(source.(*PlanAssignmentRequest_RequestType_Unassign)) 4451 } 4452 4453 // GetSingle returns value pointed by specific field of from source PlanAssignmentRequest_RequestType_Unassign 4454 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) GetSingle(source *PlanAssignmentRequest_RequestType_Unassign) (interface{}, bool) { 4455 switch fp.selector { 4456 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4457 res := source.GetAssignment() 4458 return res, res != nil 4459 default: 4460 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", fp.selector)) 4461 } 4462 } 4463 4464 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 4465 return fp.GetSingle(source.(*PlanAssignmentRequest_RequestType_Unassign)) 4466 } 4467 4468 // GetDefault returns a default value of the field type 4469 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) GetDefault() interface{} { 4470 switch fp.selector { 4471 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4472 return (*plan_assignment.Reference)(nil) 4473 default: 4474 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", fp.selector)) 4475 } 4476 } 4477 4478 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) ClearValue(item *PlanAssignmentRequest_RequestType_Unassign) { 4479 if item != nil { 4480 switch fp.selector { 4481 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4482 item.Assignment = nil 4483 default: 4484 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", fp.selector)) 4485 } 4486 } 4487 } 4488 4489 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) ClearValueRaw(item proto.Message) { 4490 fp.ClearValue(item.(*PlanAssignmentRequest_RequestType_Unassign)) 4491 } 4492 4493 // IsLeaf - whether field path is holds simple value 4494 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) IsLeaf() bool { 4495 return fp.selector == PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment 4496 } 4497 4498 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 4499 return []gotenobject.FieldPath{fp} 4500 } 4501 4502 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) WithIValue(value interface{}) PlanAssignmentRequestRequestTypeUnassign_FieldPathValue { 4503 switch fp.selector { 4504 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4505 return &PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue{PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath: *fp, value: value.(*plan_assignment.Reference)} 4506 default: 4507 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", fp.selector)) 4508 } 4509 } 4510 4511 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 4512 return fp.WithIValue(value) 4513 } 4514 4515 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) WithIArrayOfValues(values interface{}) PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues { 4516 fpaov := &PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath: *fp} 4517 switch fp.selector { 4518 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4519 return &PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayOfValues{PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath: *fp, values: values.([]*plan_assignment.Reference)} 4520 default: 4521 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", fp.selector)) 4522 } 4523 return fpaov 4524 } 4525 4526 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 4527 return fp.WithIArrayOfValues(values) 4528 } 4529 4530 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) WithIArrayItemValue(value interface{}) PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue { 4531 switch fp.selector { 4532 default: 4533 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", fp.selector)) 4534 } 4535 } 4536 4537 func (fp *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 4538 return fp.WithIArrayItemValue(value) 4539 } 4540 4541 // PlanAssignmentRequestRequestTypeUnassign_FieldPathValue allows storing values for Unassign fields according to their type 4542 type PlanAssignmentRequestRequestTypeUnassign_FieldPathValue interface { 4543 PlanAssignmentRequestRequestTypeUnassign_FieldPath 4544 gotenobject.FieldPathValue 4545 SetTo(target **PlanAssignmentRequest_RequestType_Unassign) 4546 CompareWith(*PlanAssignmentRequest_RequestType_Unassign) (cmp int, comparable bool) 4547 } 4548 4549 func ParsePlanAssignmentRequestRequestTypeUnassign_FieldPathValue(pathStr, valueStr string) (PlanAssignmentRequestRequestTypeUnassign_FieldPathValue, error) { 4550 fp, err := ParsePlanAssignmentRequestRequestTypeUnassign_FieldPath(pathStr) 4551 if err != nil { 4552 return nil, err 4553 } 4554 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 4555 if err != nil { 4556 return nil, status.Errorf(codes.InvalidArgument, "error parsing Unassign field path value from %s: %v", valueStr, err) 4557 } 4558 return fpv.(PlanAssignmentRequestRequestTypeUnassign_FieldPathValue), nil 4559 } 4560 4561 func MustParsePlanAssignmentRequestRequestTypeUnassign_FieldPathValue(pathStr, valueStr string) PlanAssignmentRequestRequestTypeUnassign_FieldPathValue { 4562 fpv, err := ParsePlanAssignmentRequestRequestTypeUnassign_FieldPathValue(pathStr, valueStr) 4563 if err != nil { 4564 panic(err) 4565 } 4566 return fpv 4567 } 4568 4569 type PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue struct { 4570 PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath 4571 value interface{} 4572 } 4573 4574 var _ PlanAssignmentRequestRequestTypeUnassign_FieldPathValue = (*PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue)(nil) 4575 4576 // GetRawValue returns raw value stored under selected path for 'Unassign' as interface{} 4577 func (fpv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue) GetRawValue() interface{} { 4578 return fpv.value 4579 } 4580 func (fpv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue) AsAssignmentValue() (*plan_assignment.Reference, bool) { 4581 res, ok := fpv.value.(*plan_assignment.Reference) 4582 return res, ok 4583 } 4584 4585 // SetTo stores value for selected field for object Unassign 4586 func (fpv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue) SetTo(target **PlanAssignmentRequest_RequestType_Unassign) { 4587 if *target == nil { 4588 *target = new(PlanAssignmentRequest_RequestType_Unassign) 4589 } 4590 switch fpv.selector { 4591 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4592 (*target).Assignment = fpv.value.(*plan_assignment.Reference) 4593 default: 4594 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", fpv.selector)) 4595 } 4596 } 4597 4598 func (fpv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue) SetToRaw(target proto.Message) { 4599 typedObject := target.(*PlanAssignmentRequest_RequestType_Unassign) 4600 fpv.SetTo(&typedObject) 4601 } 4602 4603 // CompareWith compares value in the 'PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue' with the value under path in 'PlanAssignmentRequest_RequestType_Unassign'. 4604 func (fpv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue) CompareWith(source *PlanAssignmentRequest_RequestType_Unassign) (int, bool) { 4605 switch fpv.selector { 4606 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4607 leftValue := fpv.value.(*plan_assignment.Reference) 4608 rightValue := source.GetAssignment() 4609 if leftValue == nil { 4610 if rightValue != nil { 4611 return -1, true 4612 } 4613 return 0, true 4614 } 4615 if rightValue == nil { 4616 return 1, true 4617 } 4618 if leftValue.String() == rightValue.String() { 4619 return 0, true 4620 } else if leftValue.String() < rightValue.String() { 4621 return -1, true 4622 } else { 4623 return 1, true 4624 } 4625 default: 4626 panic(fmt.Sprintf("Invalid selector for PlanAssignmentRequest_RequestType_Unassign: %d", fpv.selector)) 4627 } 4628 } 4629 4630 func (fpv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 4631 return fpv.CompareWith(source.(*PlanAssignmentRequest_RequestType_Unassign)) 4632 } 4633 4634 // PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue allows storing single item in Path-specific values for Unassign according to their type 4635 // Present only for array (repeated) types. 4636 type PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue interface { 4637 gotenobject.FieldPathArrayItemValue 4638 PlanAssignmentRequestRequestTypeUnassign_FieldPath 4639 ContainsValue(*PlanAssignmentRequest_RequestType_Unassign) bool 4640 } 4641 4642 // ParsePlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 4643 func ParsePlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue(pathStr, valueStr string) (PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue, error) { 4644 fp, err := ParsePlanAssignmentRequestRequestTypeUnassign_FieldPath(pathStr) 4645 if err != nil { 4646 return nil, err 4647 } 4648 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 4649 if err != nil { 4650 return nil, status.Errorf(codes.InvalidArgument, "error parsing Unassign field path array item value from %s: %v", valueStr, err) 4651 } 4652 return fpaiv.(PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue), nil 4653 } 4654 4655 func MustParsePlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue(pathStr, valueStr string) PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue { 4656 fpaiv, err := ParsePlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue(pathStr, valueStr) 4657 if err != nil { 4658 panic(err) 4659 } 4660 return fpaiv 4661 } 4662 4663 type PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayItemValue struct { 4664 PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath 4665 value interface{} 4666 } 4667 4668 var _ PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayItemValue = (*PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayItemValue)(nil) 4669 4670 // GetRawValue returns stored element value for array in object PlanAssignmentRequest_RequestType_Unassign as interface{} 4671 func (fpaiv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 4672 return fpaiv.value 4673 } 4674 4675 func (fpaiv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayItemValue) GetSingle(source *PlanAssignmentRequest_RequestType_Unassign) (interface{}, bool) { 4676 return nil, false 4677 } 4678 4679 func (fpaiv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 4680 return fpaiv.GetSingle(source.(*PlanAssignmentRequest_RequestType_Unassign)) 4681 } 4682 4683 // Contains returns a boolean indicating if value that is being held is present in given 'Unassign' 4684 func (fpaiv *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayItemValue) ContainsValue(source *PlanAssignmentRequest_RequestType_Unassign) bool { 4685 slice := fpaiv.PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath.Get(source) 4686 for _, v := range slice { 4687 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 4688 if proto.Equal(asProtoMsg, v.(proto.Message)) { 4689 return true 4690 } 4691 } else if reflect.DeepEqual(v, fpaiv.value) { 4692 return true 4693 } 4694 } 4695 return false 4696 } 4697 4698 // PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues allows storing slice of values for Unassign fields according to their type 4699 type PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues interface { 4700 gotenobject.FieldPathArrayOfValues 4701 PlanAssignmentRequestRequestTypeUnassign_FieldPath 4702 } 4703 4704 func ParsePlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues(pathStr, valuesStr string) (PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues, error) { 4705 fp, err := ParsePlanAssignmentRequestRequestTypeUnassign_FieldPath(pathStr) 4706 if err != nil { 4707 return nil, err 4708 } 4709 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 4710 if err != nil { 4711 return nil, status.Errorf(codes.InvalidArgument, "error parsing Unassign field path array of values from %s: %v", valuesStr, err) 4712 } 4713 return fpaov.(PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues), nil 4714 } 4715 4716 func MustParsePlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues(pathStr, valuesStr string) PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues { 4717 fpaov, err := ParsePlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues(pathStr, valuesStr) 4718 if err != nil { 4719 panic(err) 4720 } 4721 return fpaov 4722 } 4723 4724 type PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayOfValues struct { 4725 PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPath 4726 values interface{} 4727 } 4728 4729 var _ PlanAssignmentRequestRequestTypeUnassign_FieldPathArrayOfValues = (*PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayOfValues)(nil) 4730 4731 func (fpaov *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 4732 switch fpaov.selector { 4733 case PlanAssignmentRequestRequestTypeUnassign_FieldPathSelectorAssignment: 4734 for _, v := range fpaov.values.([]*plan_assignment.Reference) { 4735 values = append(values, v) 4736 } 4737 } 4738 return 4739 } 4740 func (fpaov *PlanAssignmentRequestRequestTypeUnassign_FieldTerminalPathArrayOfValues) AsAssignmentArrayOfValues() ([]*plan_assignment.Reference, bool) { 4741 res, ok := fpaov.values.([]*plan_assignment.Reference) 4742 return res, ok 4743 }