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