github.com/cloudwan/edgelq-sdk@v1.15.4/devices/resources/v1alpha2/customized_image/customized_image.pb.fieldpath.go (about) 1 // Code generated by protoc-gen-goten-object 2 // File: edgelq/devices/proto/v1alpha2/customized_image.proto 3 // DO NOT EDIT!!! 4 5 package customized_image 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 project "github.com/cloudwan/edgelq-sdk/devices/resources/v1alpha2/project" 27 meta "github.com/cloudwan/goten-sdk/types/meta" 28 ) 29 30 // ensure the imports are used 31 var ( 32 _ = new(json.Marshaler) 33 _ = new(fmt.Stringer) 34 _ = reflect.DeepEqual 35 _ = strings.Builder{} 36 _ = time.Second 37 38 _ = strcase.ToLowerCamel 39 _ = codes.NotFound 40 _ = status.Status{} 41 _ = protojson.UnmarshalOptions{} 42 _ = new(proto.Message) 43 _ = protoregistry.GlobalTypes 44 45 _ = new(gotenobject.FieldPath) 46 ) 47 48 // make sure we're using proto imports 49 var ( 50 _ = &project.Project{} 51 _ = &meta.Meta{} 52 ) 53 54 // FieldPath provides implementation to handle 55 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 56 type CustomizedImage_FieldPath interface { 57 gotenobject.FieldPath 58 Selector() CustomizedImage_FieldPathSelector 59 Get(source *CustomizedImage) []interface{} 60 GetSingle(source *CustomizedImage) (interface{}, bool) 61 ClearValue(item *CustomizedImage) 62 63 // Those methods build corresponding CustomizedImage_FieldPathValue 64 // (or array of values) and holds passed value. Panics if injected type is incorrect. 65 WithIValue(value interface{}) CustomizedImage_FieldPathValue 66 WithIArrayOfValues(values interface{}) CustomizedImage_FieldPathArrayOfValues 67 WithIArrayItemValue(value interface{}) CustomizedImage_FieldPathArrayItemValue 68 } 69 70 type CustomizedImage_FieldPathSelector int32 71 72 const ( 73 CustomizedImage_FieldPathSelectorName CustomizedImage_FieldPathSelector = 0 74 CustomizedImage_FieldPathSelectorMetadata CustomizedImage_FieldPathSelector = 1 75 CustomizedImage_FieldPathSelectorSpec CustomizedImage_FieldPathSelector = 2 76 CustomizedImage_FieldPathSelectorStatus CustomizedImage_FieldPathSelector = 3 77 ) 78 79 func (s CustomizedImage_FieldPathSelector) String() string { 80 switch s { 81 case CustomizedImage_FieldPathSelectorName: 82 return "name" 83 case CustomizedImage_FieldPathSelectorMetadata: 84 return "metadata" 85 case CustomizedImage_FieldPathSelectorSpec: 86 return "spec" 87 case CustomizedImage_FieldPathSelectorStatus: 88 return "status" 89 default: 90 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", s)) 91 } 92 } 93 94 func BuildCustomizedImage_FieldPath(fp gotenobject.RawFieldPath) (CustomizedImage_FieldPath, error) { 95 if len(fp) == 0 { 96 return nil, status.Error(codes.InvalidArgument, "empty field path for object CustomizedImage") 97 } 98 if len(fp) == 1 { 99 switch fp[0] { 100 case "name": 101 return &CustomizedImage_FieldTerminalPath{selector: CustomizedImage_FieldPathSelectorName}, nil 102 case "metadata": 103 return &CustomizedImage_FieldTerminalPath{selector: CustomizedImage_FieldPathSelectorMetadata}, nil 104 case "spec": 105 return &CustomizedImage_FieldTerminalPath{selector: CustomizedImage_FieldPathSelectorSpec}, nil 106 case "status": 107 return &CustomizedImage_FieldTerminalPath{selector: CustomizedImage_FieldPathSelectorStatus}, nil 108 } 109 } else { 110 switch fp[0] { 111 case "metadata": 112 if subpath, err := meta.BuildMeta_FieldPath(fp[1:]); err != nil { 113 return nil, err 114 } else { 115 return &CustomizedImage_FieldSubPath{selector: CustomizedImage_FieldPathSelectorMetadata, subPath: subpath}, nil 116 } 117 case "spec": 118 if subpath, err := BuildCustomizedImageSpec_FieldPath(fp[1:]); err != nil { 119 return nil, err 120 } else { 121 return &CustomizedImage_FieldSubPath{selector: CustomizedImage_FieldPathSelectorSpec, subPath: subpath}, nil 122 } 123 case "status": 124 if subpath, err := BuildCustomizedImageStatus_FieldPath(fp[1:]); err != nil { 125 return nil, err 126 } else { 127 return &CustomizedImage_FieldSubPath{selector: CustomizedImage_FieldPathSelectorStatus, subPath: subpath}, nil 128 } 129 } 130 } 131 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object CustomizedImage", fp) 132 } 133 134 func ParseCustomizedImage_FieldPath(rawField string) (CustomizedImage_FieldPath, error) { 135 fp, err := gotenobject.ParseRawFieldPath(rawField) 136 if err != nil { 137 return nil, err 138 } 139 return BuildCustomizedImage_FieldPath(fp) 140 } 141 142 func MustParseCustomizedImage_FieldPath(rawField string) CustomizedImage_FieldPath { 143 fp, err := ParseCustomizedImage_FieldPath(rawField) 144 if err != nil { 145 panic(err) 146 } 147 return fp 148 } 149 150 type CustomizedImage_FieldTerminalPath struct { 151 selector CustomizedImage_FieldPathSelector 152 } 153 154 var _ CustomizedImage_FieldPath = (*CustomizedImage_FieldTerminalPath)(nil) 155 156 func (fp *CustomizedImage_FieldTerminalPath) Selector() CustomizedImage_FieldPathSelector { 157 return fp.selector 158 } 159 160 // String returns path representation in proto convention 161 func (fp *CustomizedImage_FieldTerminalPath) String() string { 162 return fp.selector.String() 163 } 164 165 // JSONString returns path representation is JSON convention 166 func (fp *CustomizedImage_FieldTerminalPath) JSONString() string { 167 return strcase.ToLowerCamel(fp.String()) 168 } 169 170 // Get returns all values pointed by specific field from source CustomizedImage 171 func (fp *CustomizedImage_FieldTerminalPath) Get(source *CustomizedImage) (values []interface{}) { 172 if source != nil { 173 switch fp.selector { 174 case CustomizedImage_FieldPathSelectorName: 175 if source.Name != nil { 176 values = append(values, source.Name) 177 } 178 case CustomizedImage_FieldPathSelectorMetadata: 179 if source.Metadata != nil { 180 values = append(values, source.Metadata) 181 } 182 case CustomizedImage_FieldPathSelectorSpec: 183 if source.Spec != nil { 184 values = append(values, source.Spec) 185 } 186 case CustomizedImage_FieldPathSelectorStatus: 187 if source.Status != nil { 188 values = append(values, source.Status) 189 } 190 default: 191 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fp.selector)) 192 } 193 } 194 return 195 } 196 197 func (fp *CustomizedImage_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 198 return fp.Get(source.(*CustomizedImage)) 199 } 200 201 // GetSingle returns value pointed by specific field of from source CustomizedImage 202 func (fp *CustomizedImage_FieldTerminalPath) GetSingle(source *CustomizedImage) (interface{}, bool) { 203 switch fp.selector { 204 case CustomizedImage_FieldPathSelectorName: 205 res := source.GetName() 206 return res, res != nil 207 case CustomizedImage_FieldPathSelectorMetadata: 208 res := source.GetMetadata() 209 return res, res != nil 210 case CustomizedImage_FieldPathSelectorSpec: 211 res := source.GetSpec() 212 return res, res != nil 213 case CustomizedImage_FieldPathSelectorStatus: 214 res := source.GetStatus() 215 return res, res != nil 216 default: 217 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fp.selector)) 218 } 219 } 220 221 func (fp *CustomizedImage_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 222 return fp.GetSingle(source.(*CustomizedImage)) 223 } 224 225 // GetDefault returns a default value of the field type 226 func (fp *CustomizedImage_FieldTerminalPath) GetDefault() interface{} { 227 switch fp.selector { 228 case CustomizedImage_FieldPathSelectorName: 229 return (*Name)(nil) 230 case CustomizedImage_FieldPathSelectorMetadata: 231 return (*meta.Meta)(nil) 232 case CustomizedImage_FieldPathSelectorSpec: 233 return (*CustomizedImage_Spec)(nil) 234 case CustomizedImage_FieldPathSelectorStatus: 235 return (*CustomizedImage_Status)(nil) 236 default: 237 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fp.selector)) 238 } 239 } 240 241 func (fp *CustomizedImage_FieldTerminalPath) ClearValue(item *CustomizedImage) { 242 if item != nil { 243 switch fp.selector { 244 case CustomizedImage_FieldPathSelectorName: 245 item.Name = nil 246 case CustomizedImage_FieldPathSelectorMetadata: 247 item.Metadata = nil 248 case CustomizedImage_FieldPathSelectorSpec: 249 item.Spec = nil 250 case CustomizedImage_FieldPathSelectorStatus: 251 item.Status = nil 252 default: 253 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fp.selector)) 254 } 255 } 256 } 257 258 func (fp *CustomizedImage_FieldTerminalPath) ClearValueRaw(item proto.Message) { 259 fp.ClearValue(item.(*CustomizedImage)) 260 } 261 262 // IsLeaf - whether field path is holds simple value 263 func (fp *CustomizedImage_FieldTerminalPath) IsLeaf() bool { 264 return fp.selector == CustomizedImage_FieldPathSelectorName 265 } 266 267 func (fp *CustomizedImage_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 268 return []gotenobject.FieldPath{fp} 269 } 270 271 func (fp *CustomizedImage_FieldTerminalPath) WithIValue(value interface{}) CustomizedImage_FieldPathValue { 272 switch fp.selector { 273 case CustomizedImage_FieldPathSelectorName: 274 return &CustomizedImage_FieldTerminalPathValue{CustomizedImage_FieldTerminalPath: *fp, value: value.(*Name)} 275 case CustomizedImage_FieldPathSelectorMetadata: 276 return &CustomizedImage_FieldTerminalPathValue{CustomizedImage_FieldTerminalPath: *fp, value: value.(*meta.Meta)} 277 case CustomizedImage_FieldPathSelectorSpec: 278 return &CustomizedImage_FieldTerminalPathValue{CustomizedImage_FieldTerminalPath: *fp, value: value.(*CustomizedImage_Spec)} 279 case CustomizedImage_FieldPathSelectorStatus: 280 return &CustomizedImage_FieldTerminalPathValue{CustomizedImage_FieldTerminalPath: *fp, value: value.(*CustomizedImage_Status)} 281 default: 282 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fp.selector)) 283 } 284 } 285 286 func (fp *CustomizedImage_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 287 return fp.WithIValue(value) 288 } 289 290 func (fp *CustomizedImage_FieldTerminalPath) WithIArrayOfValues(values interface{}) CustomizedImage_FieldPathArrayOfValues { 291 fpaov := &CustomizedImage_FieldTerminalPathArrayOfValues{CustomizedImage_FieldTerminalPath: *fp} 292 switch fp.selector { 293 case CustomizedImage_FieldPathSelectorName: 294 return &CustomizedImage_FieldTerminalPathArrayOfValues{CustomizedImage_FieldTerminalPath: *fp, values: values.([]*Name)} 295 case CustomizedImage_FieldPathSelectorMetadata: 296 return &CustomizedImage_FieldTerminalPathArrayOfValues{CustomizedImage_FieldTerminalPath: *fp, values: values.([]*meta.Meta)} 297 case CustomizedImage_FieldPathSelectorSpec: 298 return &CustomizedImage_FieldTerminalPathArrayOfValues{CustomizedImage_FieldTerminalPath: *fp, values: values.([]*CustomizedImage_Spec)} 299 case CustomizedImage_FieldPathSelectorStatus: 300 return &CustomizedImage_FieldTerminalPathArrayOfValues{CustomizedImage_FieldTerminalPath: *fp, values: values.([]*CustomizedImage_Status)} 301 default: 302 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fp.selector)) 303 } 304 return fpaov 305 } 306 307 func (fp *CustomizedImage_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 308 return fp.WithIArrayOfValues(values) 309 } 310 311 func (fp *CustomizedImage_FieldTerminalPath) WithIArrayItemValue(value interface{}) CustomizedImage_FieldPathArrayItemValue { 312 switch fp.selector { 313 default: 314 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fp.selector)) 315 } 316 } 317 318 func (fp *CustomizedImage_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 319 return fp.WithIArrayItemValue(value) 320 } 321 322 type CustomizedImage_FieldSubPath struct { 323 selector CustomizedImage_FieldPathSelector 324 subPath gotenobject.FieldPath 325 } 326 327 var _ CustomizedImage_FieldPath = (*CustomizedImage_FieldSubPath)(nil) 328 329 func (fps *CustomizedImage_FieldSubPath) Selector() CustomizedImage_FieldPathSelector { 330 return fps.selector 331 } 332 func (fps *CustomizedImage_FieldSubPath) AsMetadataSubPath() (meta.Meta_FieldPath, bool) { 333 res, ok := fps.subPath.(meta.Meta_FieldPath) 334 return res, ok 335 } 336 func (fps *CustomizedImage_FieldSubPath) AsSpecSubPath() (CustomizedImageSpec_FieldPath, bool) { 337 res, ok := fps.subPath.(CustomizedImageSpec_FieldPath) 338 return res, ok 339 } 340 func (fps *CustomizedImage_FieldSubPath) AsStatusSubPath() (CustomizedImageStatus_FieldPath, bool) { 341 res, ok := fps.subPath.(CustomizedImageStatus_FieldPath) 342 return res, ok 343 } 344 345 // String returns path representation in proto convention 346 func (fps *CustomizedImage_FieldSubPath) String() string { 347 return fps.selector.String() + "." + fps.subPath.String() 348 } 349 350 // JSONString returns path representation is JSON convention 351 func (fps *CustomizedImage_FieldSubPath) JSONString() string { 352 return strcase.ToLowerCamel(fps.selector.String()) + "." + fps.subPath.JSONString() 353 } 354 355 // Get returns all values pointed by selected field from source CustomizedImage 356 func (fps *CustomizedImage_FieldSubPath) Get(source *CustomizedImage) (values []interface{}) { 357 switch fps.selector { 358 case CustomizedImage_FieldPathSelectorMetadata: 359 values = append(values, fps.subPath.GetRaw(source.GetMetadata())...) 360 case CustomizedImage_FieldPathSelectorSpec: 361 values = append(values, fps.subPath.GetRaw(source.GetSpec())...) 362 case CustomizedImage_FieldPathSelectorStatus: 363 values = append(values, fps.subPath.GetRaw(source.GetStatus())...) 364 default: 365 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fps.selector)) 366 } 367 return 368 } 369 370 func (fps *CustomizedImage_FieldSubPath) GetRaw(source proto.Message) []interface{} { 371 return fps.Get(source.(*CustomizedImage)) 372 } 373 374 // GetSingle returns value of selected field from source CustomizedImage 375 func (fps *CustomizedImage_FieldSubPath) GetSingle(source *CustomizedImage) (interface{}, bool) { 376 switch fps.selector { 377 case CustomizedImage_FieldPathSelectorMetadata: 378 if source.GetMetadata() == nil { 379 return nil, false 380 } 381 return fps.subPath.GetSingleRaw(source.GetMetadata()) 382 case CustomizedImage_FieldPathSelectorSpec: 383 if source.GetSpec() == nil { 384 return nil, false 385 } 386 return fps.subPath.GetSingleRaw(source.GetSpec()) 387 case CustomizedImage_FieldPathSelectorStatus: 388 if source.GetStatus() == nil { 389 return nil, false 390 } 391 return fps.subPath.GetSingleRaw(source.GetStatus()) 392 default: 393 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fps.selector)) 394 } 395 } 396 397 func (fps *CustomizedImage_FieldSubPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 398 return fps.GetSingle(source.(*CustomizedImage)) 399 } 400 401 // GetDefault returns a default value of the field type 402 func (fps *CustomizedImage_FieldSubPath) GetDefault() interface{} { 403 return fps.subPath.GetDefault() 404 } 405 406 func (fps *CustomizedImage_FieldSubPath) ClearValue(item *CustomizedImage) { 407 if item != nil { 408 switch fps.selector { 409 case CustomizedImage_FieldPathSelectorMetadata: 410 fps.subPath.ClearValueRaw(item.Metadata) 411 case CustomizedImage_FieldPathSelectorSpec: 412 fps.subPath.ClearValueRaw(item.Spec) 413 case CustomizedImage_FieldPathSelectorStatus: 414 fps.subPath.ClearValueRaw(item.Status) 415 default: 416 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fps.selector)) 417 } 418 } 419 } 420 421 func (fps *CustomizedImage_FieldSubPath) ClearValueRaw(item proto.Message) { 422 fps.ClearValue(item.(*CustomizedImage)) 423 } 424 425 // IsLeaf - whether field path is holds simple value 426 func (fps *CustomizedImage_FieldSubPath) IsLeaf() bool { 427 return fps.subPath.IsLeaf() 428 } 429 430 func (fps *CustomizedImage_FieldSubPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 431 iPaths := []gotenobject.FieldPath{&CustomizedImage_FieldTerminalPath{selector: fps.selector}} 432 iPaths = append(iPaths, fps.subPath.SplitIntoTerminalIPaths()...) 433 return iPaths 434 } 435 436 func (fps *CustomizedImage_FieldSubPath) WithIValue(value interface{}) CustomizedImage_FieldPathValue { 437 return &CustomizedImage_FieldSubPathValue{fps, fps.subPath.WithRawIValue(value)} 438 } 439 440 func (fps *CustomizedImage_FieldSubPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 441 return fps.WithIValue(value) 442 } 443 444 func (fps *CustomizedImage_FieldSubPath) WithIArrayOfValues(values interface{}) CustomizedImage_FieldPathArrayOfValues { 445 return &CustomizedImage_FieldSubPathArrayOfValues{fps, fps.subPath.WithRawIArrayOfValues(values)} 446 } 447 448 func (fps *CustomizedImage_FieldSubPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 449 return fps.WithIArrayOfValues(values) 450 } 451 452 func (fps *CustomizedImage_FieldSubPath) WithIArrayItemValue(value interface{}) CustomizedImage_FieldPathArrayItemValue { 453 return &CustomizedImage_FieldSubPathArrayItemValue{fps, fps.subPath.WithRawIArrayItemValue(value)} 454 } 455 456 func (fps *CustomizedImage_FieldSubPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 457 return fps.WithIArrayItemValue(value) 458 } 459 460 // CustomizedImage_FieldPathValue allows storing values for CustomizedImage fields according to their type 461 type CustomizedImage_FieldPathValue interface { 462 CustomizedImage_FieldPath 463 gotenobject.FieldPathValue 464 SetTo(target **CustomizedImage) 465 CompareWith(*CustomizedImage) (cmp int, comparable bool) 466 } 467 468 func ParseCustomizedImage_FieldPathValue(pathStr, valueStr string) (CustomizedImage_FieldPathValue, error) { 469 fp, err := ParseCustomizedImage_FieldPath(pathStr) 470 if err != nil { 471 return nil, err 472 } 473 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 474 if err != nil { 475 return nil, status.Errorf(codes.InvalidArgument, "error parsing CustomizedImage field path value from %s: %v", valueStr, err) 476 } 477 return fpv.(CustomizedImage_FieldPathValue), nil 478 } 479 480 func MustParseCustomizedImage_FieldPathValue(pathStr, valueStr string) CustomizedImage_FieldPathValue { 481 fpv, err := ParseCustomizedImage_FieldPathValue(pathStr, valueStr) 482 if err != nil { 483 panic(err) 484 } 485 return fpv 486 } 487 488 type CustomizedImage_FieldTerminalPathValue struct { 489 CustomizedImage_FieldTerminalPath 490 value interface{} 491 } 492 493 var _ CustomizedImage_FieldPathValue = (*CustomizedImage_FieldTerminalPathValue)(nil) 494 495 // GetRawValue returns raw value stored under selected path for 'CustomizedImage' as interface{} 496 func (fpv *CustomizedImage_FieldTerminalPathValue) GetRawValue() interface{} { 497 return fpv.value 498 } 499 func (fpv *CustomizedImage_FieldTerminalPathValue) AsNameValue() (*Name, bool) { 500 res, ok := fpv.value.(*Name) 501 return res, ok 502 } 503 func (fpv *CustomizedImage_FieldTerminalPathValue) AsMetadataValue() (*meta.Meta, bool) { 504 res, ok := fpv.value.(*meta.Meta) 505 return res, ok 506 } 507 func (fpv *CustomizedImage_FieldTerminalPathValue) AsSpecValue() (*CustomizedImage_Spec, bool) { 508 res, ok := fpv.value.(*CustomizedImage_Spec) 509 return res, ok 510 } 511 func (fpv *CustomizedImage_FieldTerminalPathValue) AsStatusValue() (*CustomizedImage_Status, bool) { 512 res, ok := fpv.value.(*CustomizedImage_Status) 513 return res, ok 514 } 515 516 // SetTo stores value for selected field for object CustomizedImage 517 func (fpv *CustomizedImage_FieldTerminalPathValue) SetTo(target **CustomizedImage) { 518 if *target == nil { 519 *target = new(CustomizedImage) 520 } 521 switch fpv.selector { 522 case CustomizedImage_FieldPathSelectorName: 523 (*target).Name = fpv.value.(*Name) 524 case CustomizedImage_FieldPathSelectorMetadata: 525 (*target).Metadata = fpv.value.(*meta.Meta) 526 case CustomizedImage_FieldPathSelectorSpec: 527 (*target).Spec = fpv.value.(*CustomizedImage_Spec) 528 case CustomizedImage_FieldPathSelectorStatus: 529 (*target).Status = fpv.value.(*CustomizedImage_Status) 530 default: 531 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fpv.selector)) 532 } 533 } 534 535 func (fpv *CustomizedImage_FieldTerminalPathValue) SetToRaw(target proto.Message) { 536 typedObject := target.(*CustomizedImage) 537 fpv.SetTo(&typedObject) 538 } 539 540 // CompareWith compares value in the 'CustomizedImage_FieldTerminalPathValue' with the value under path in 'CustomizedImage'. 541 func (fpv *CustomizedImage_FieldTerminalPathValue) CompareWith(source *CustomizedImage) (int, bool) { 542 switch fpv.selector { 543 case CustomizedImage_FieldPathSelectorName: 544 leftValue := fpv.value.(*Name) 545 rightValue := source.GetName() 546 if leftValue == nil { 547 if rightValue != nil { 548 return -1, true 549 } 550 return 0, true 551 } 552 if rightValue == nil { 553 return 1, true 554 } 555 if leftValue.String() == rightValue.String() { 556 return 0, true 557 } else if leftValue.String() < rightValue.String() { 558 return -1, true 559 } else { 560 return 1, true 561 } 562 case CustomizedImage_FieldPathSelectorMetadata: 563 return 0, false 564 case CustomizedImage_FieldPathSelectorSpec: 565 return 0, false 566 case CustomizedImage_FieldPathSelectorStatus: 567 return 0, false 568 default: 569 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fpv.selector)) 570 } 571 } 572 573 func (fpv *CustomizedImage_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 574 return fpv.CompareWith(source.(*CustomizedImage)) 575 } 576 577 type CustomizedImage_FieldSubPathValue struct { 578 CustomizedImage_FieldPath 579 subPathValue gotenobject.FieldPathValue 580 } 581 582 var _ CustomizedImage_FieldPathValue = (*CustomizedImage_FieldSubPathValue)(nil) 583 584 func (fpvs *CustomizedImage_FieldSubPathValue) AsMetadataPathValue() (meta.Meta_FieldPathValue, bool) { 585 res, ok := fpvs.subPathValue.(meta.Meta_FieldPathValue) 586 return res, ok 587 } 588 func (fpvs *CustomizedImage_FieldSubPathValue) AsSpecPathValue() (CustomizedImageSpec_FieldPathValue, bool) { 589 res, ok := fpvs.subPathValue.(CustomizedImageSpec_FieldPathValue) 590 return res, ok 591 } 592 func (fpvs *CustomizedImage_FieldSubPathValue) AsStatusPathValue() (CustomizedImageStatus_FieldPathValue, bool) { 593 res, ok := fpvs.subPathValue.(CustomizedImageStatus_FieldPathValue) 594 return res, ok 595 } 596 597 func (fpvs *CustomizedImage_FieldSubPathValue) SetTo(target **CustomizedImage) { 598 if *target == nil { 599 *target = new(CustomizedImage) 600 } 601 switch fpvs.Selector() { 602 case CustomizedImage_FieldPathSelectorMetadata: 603 fpvs.subPathValue.(meta.Meta_FieldPathValue).SetTo(&(*target).Metadata) 604 case CustomizedImage_FieldPathSelectorSpec: 605 fpvs.subPathValue.(CustomizedImageSpec_FieldPathValue).SetTo(&(*target).Spec) 606 case CustomizedImage_FieldPathSelectorStatus: 607 fpvs.subPathValue.(CustomizedImageStatus_FieldPathValue).SetTo(&(*target).Status) 608 default: 609 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fpvs.Selector())) 610 } 611 } 612 613 func (fpvs *CustomizedImage_FieldSubPathValue) SetToRaw(target proto.Message) { 614 typedObject := target.(*CustomizedImage) 615 fpvs.SetTo(&typedObject) 616 } 617 618 func (fpvs *CustomizedImage_FieldSubPathValue) GetRawValue() interface{} { 619 return fpvs.subPathValue.GetRawValue() 620 } 621 622 func (fpvs *CustomizedImage_FieldSubPathValue) CompareWith(source *CustomizedImage) (int, bool) { 623 switch fpvs.Selector() { 624 case CustomizedImage_FieldPathSelectorMetadata: 625 return fpvs.subPathValue.(meta.Meta_FieldPathValue).CompareWith(source.GetMetadata()) 626 case CustomizedImage_FieldPathSelectorSpec: 627 return fpvs.subPathValue.(CustomizedImageSpec_FieldPathValue).CompareWith(source.GetSpec()) 628 case CustomizedImage_FieldPathSelectorStatus: 629 return fpvs.subPathValue.(CustomizedImageStatus_FieldPathValue).CompareWith(source.GetStatus()) 630 default: 631 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fpvs.Selector())) 632 } 633 } 634 635 func (fpvs *CustomizedImage_FieldSubPathValue) CompareWithRaw(source proto.Message) (int, bool) { 636 return fpvs.CompareWith(source.(*CustomizedImage)) 637 } 638 639 // CustomizedImage_FieldPathArrayItemValue allows storing single item in Path-specific values for CustomizedImage according to their type 640 // Present only for array (repeated) types. 641 type CustomizedImage_FieldPathArrayItemValue interface { 642 gotenobject.FieldPathArrayItemValue 643 CustomizedImage_FieldPath 644 ContainsValue(*CustomizedImage) bool 645 } 646 647 // ParseCustomizedImage_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 648 func ParseCustomizedImage_FieldPathArrayItemValue(pathStr, valueStr string) (CustomizedImage_FieldPathArrayItemValue, error) { 649 fp, err := ParseCustomizedImage_FieldPath(pathStr) 650 if err != nil { 651 return nil, err 652 } 653 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 654 if err != nil { 655 return nil, status.Errorf(codes.InvalidArgument, "error parsing CustomizedImage field path array item value from %s: %v", valueStr, err) 656 } 657 return fpaiv.(CustomizedImage_FieldPathArrayItemValue), nil 658 } 659 660 func MustParseCustomizedImage_FieldPathArrayItemValue(pathStr, valueStr string) CustomizedImage_FieldPathArrayItemValue { 661 fpaiv, err := ParseCustomizedImage_FieldPathArrayItemValue(pathStr, valueStr) 662 if err != nil { 663 panic(err) 664 } 665 return fpaiv 666 } 667 668 type CustomizedImage_FieldTerminalPathArrayItemValue struct { 669 CustomizedImage_FieldTerminalPath 670 value interface{} 671 } 672 673 var _ CustomizedImage_FieldPathArrayItemValue = (*CustomizedImage_FieldTerminalPathArrayItemValue)(nil) 674 675 // GetRawValue returns stored element value for array in object CustomizedImage as interface{} 676 func (fpaiv *CustomizedImage_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 677 return fpaiv.value 678 } 679 680 func (fpaiv *CustomizedImage_FieldTerminalPathArrayItemValue) GetSingle(source *CustomizedImage) (interface{}, bool) { 681 return nil, false 682 } 683 684 func (fpaiv *CustomizedImage_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 685 return fpaiv.GetSingle(source.(*CustomizedImage)) 686 } 687 688 // Contains returns a boolean indicating if value that is being held is present in given 'CustomizedImage' 689 func (fpaiv *CustomizedImage_FieldTerminalPathArrayItemValue) ContainsValue(source *CustomizedImage) bool { 690 slice := fpaiv.CustomizedImage_FieldTerminalPath.Get(source) 691 for _, v := range slice { 692 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 693 if proto.Equal(asProtoMsg, v.(proto.Message)) { 694 return true 695 } 696 } else if reflect.DeepEqual(v, fpaiv.value) { 697 return true 698 } 699 } 700 return false 701 } 702 703 type CustomizedImage_FieldSubPathArrayItemValue struct { 704 CustomizedImage_FieldPath 705 subPathItemValue gotenobject.FieldPathArrayItemValue 706 } 707 708 // GetRawValue returns stored array item value 709 func (fpaivs *CustomizedImage_FieldSubPathArrayItemValue) GetRawItemValue() interface{} { 710 return fpaivs.subPathItemValue.GetRawItemValue() 711 } 712 func (fpaivs *CustomizedImage_FieldSubPathArrayItemValue) AsMetadataPathItemValue() (meta.Meta_FieldPathArrayItemValue, bool) { 713 res, ok := fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue) 714 return res, ok 715 } 716 func (fpaivs *CustomizedImage_FieldSubPathArrayItemValue) AsSpecPathItemValue() (CustomizedImageSpec_FieldPathArrayItemValue, bool) { 717 res, ok := fpaivs.subPathItemValue.(CustomizedImageSpec_FieldPathArrayItemValue) 718 return res, ok 719 } 720 func (fpaivs *CustomizedImage_FieldSubPathArrayItemValue) AsStatusPathItemValue() (CustomizedImageStatus_FieldPathArrayItemValue, bool) { 721 res, ok := fpaivs.subPathItemValue.(CustomizedImageStatus_FieldPathArrayItemValue) 722 return res, ok 723 } 724 725 // Contains returns a boolean indicating if value that is being held is present in given 'CustomizedImage' 726 func (fpaivs *CustomizedImage_FieldSubPathArrayItemValue) ContainsValue(source *CustomizedImage) bool { 727 switch fpaivs.Selector() { 728 case CustomizedImage_FieldPathSelectorMetadata: 729 return fpaivs.subPathItemValue.(meta.Meta_FieldPathArrayItemValue).ContainsValue(source.GetMetadata()) 730 case CustomizedImage_FieldPathSelectorSpec: 731 return fpaivs.subPathItemValue.(CustomizedImageSpec_FieldPathArrayItemValue).ContainsValue(source.GetSpec()) 732 case CustomizedImage_FieldPathSelectorStatus: 733 return fpaivs.subPathItemValue.(CustomizedImageStatus_FieldPathArrayItemValue).ContainsValue(source.GetStatus()) 734 default: 735 panic(fmt.Sprintf("Invalid selector for CustomizedImage: %d", fpaivs.Selector())) 736 } 737 } 738 739 // CustomizedImage_FieldPathArrayOfValues allows storing slice of values for CustomizedImage fields according to their type 740 type CustomizedImage_FieldPathArrayOfValues interface { 741 gotenobject.FieldPathArrayOfValues 742 CustomizedImage_FieldPath 743 } 744 745 func ParseCustomizedImage_FieldPathArrayOfValues(pathStr, valuesStr string) (CustomizedImage_FieldPathArrayOfValues, error) { 746 fp, err := ParseCustomizedImage_FieldPath(pathStr) 747 if err != nil { 748 return nil, err 749 } 750 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 751 if err != nil { 752 return nil, status.Errorf(codes.InvalidArgument, "error parsing CustomizedImage field path array of values from %s: %v", valuesStr, err) 753 } 754 return fpaov.(CustomizedImage_FieldPathArrayOfValues), nil 755 } 756 757 func MustParseCustomizedImage_FieldPathArrayOfValues(pathStr, valuesStr string) CustomizedImage_FieldPathArrayOfValues { 758 fpaov, err := ParseCustomizedImage_FieldPathArrayOfValues(pathStr, valuesStr) 759 if err != nil { 760 panic(err) 761 } 762 return fpaov 763 } 764 765 type CustomizedImage_FieldTerminalPathArrayOfValues struct { 766 CustomizedImage_FieldTerminalPath 767 values interface{} 768 } 769 770 var _ CustomizedImage_FieldPathArrayOfValues = (*CustomizedImage_FieldTerminalPathArrayOfValues)(nil) 771 772 func (fpaov *CustomizedImage_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 773 switch fpaov.selector { 774 case CustomizedImage_FieldPathSelectorName: 775 for _, v := range fpaov.values.([]*Name) { 776 values = append(values, v) 777 } 778 case CustomizedImage_FieldPathSelectorMetadata: 779 for _, v := range fpaov.values.([]*meta.Meta) { 780 values = append(values, v) 781 } 782 case CustomizedImage_FieldPathSelectorSpec: 783 for _, v := range fpaov.values.([]*CustomizedImage_Spec) { 784 values = append(values, v) 785 } 786 case CustomizedImage_FieldPathSelectorStatus: 787 for _, v := range fpaov.values.([]*CustomizedImage_Status) { 788 values = append(values, v) 789 } 790 } 791 return 792 } 793 func (fpaov *CustomizedImage_FieldTerminalPathArrayOfValues) AsNameArrayOfValues() ([]*Name, bool) { 794 res, ok := fpaov.values.([]*Name) 795 return res, ok 796 } 797 func (fpaov *CustomizedImage_FieldTerminalPathArrayOfValues) AsMetadataArrayOfValues() ([]*meta.Meta, bool) { 798 res, ok := fpaov.values.([]*meta.Meta) 799 return res, ok 800 } 801 func (fpaov *CustomizedImage_FieldTerminalPathArrayOfValues) AsSpecArrayOfValues() ([]*CustomizedImage_Spec, bool) { 802 res, ok := fpaov.values.([]*CustomizedImage_Spec) 803 return res, ok 804 } 805 func (fpaov *CustomizedImage_FieldTerminalPathArrayOfValues) AsStatusArrayOfValues() ([]*CustomizedImage_Status, bool) { 806 res, ok := fpaov.values.([]*CustomizedImage_Status) 807 return res, ok 808 } 809 810 type CustomizedImage_FieldSubPathArrayOfValues struct { 811 CustomizedImage_FieldPath 812 subPathArrayOfValues gotenobject.FieldPathArrayOfValues 813 } 814 815 var _ CustomizedImage_FieldPathArrayOfValues = (*CustomizedImage_FieldSubPathArrayOfValues)(nil) 816 817 func (fpsaov *CustomizedImage_FieldSubPathArrayOfValues) GetRawValues() []interface{} { 818 return fpsaov.subPathArrayOfValues.GetRawValues() 819 } 820 func (fpsaov *CustomizedImage_FieldSubPathArrayOfValues) AsMetadataPathArrayOfValues() (meta.Meta_FieldPathArrayOfValues, bool) { 821 res, ok := fpsaov.subPathArrayOfValues.(meta.Meta_FieldPathArrayOfValues) 822 return res, ok 823 } 824 func (fpsaov *CustomizedImage_FieldSubPathArrayOfValues) AsSpecPathArrayOfValues() (CustomizedImageSpec_FieldPathArrayOfValues, bool) { 825 res, ok := fpsaov.subPathArrayOfValues.(CustomizedImageSpec_FieldPathArrayOfValues) 826 return res, ok 827 } 828 func (fpsaov *CustomizedImage_FieldSubPathArrayOfValues) AsStatusPathArrayOfValues() (CustomizedImageStatus_FieldPathArrayOfValues, bool) { 829 res, ok := fpsaov.subPathArrayOfValues.(CustomizedImageStatus_FieldPathArrayOfValues) 830 return res, ok 831 } 832 833 // FieldPath provides implementation to handle 834 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 835 type CustomizedImageSpec_FieldPath interface { 836 gotenobject.FieldPath 837 Selector() CustomizedImageSpec_FieldPathSelector 838 Get(source *CustomizedImage_Spec) []interface{} 839 GetSingle(source *CustomizedImage_Spec) (interface{}, bool) 840 ClearValue(item *CustomizedImage_Spec) 841 842 // Those methods build corresponding CustomizedImageSpec_FieldPathValue 843 // (or array of values) and holds passed value. Panics if injected type is incorrect. 844 WithIValue(value interface{}) CustomizedImageSpec_FieldPathValue 845 WithIArrayOfValues(values interface{}) CustomizedImageSpec_FieldPathArrayOfValues 846 WithIArrayItemValue(value interface{}) CustomizedImageSpec_FieldPathArrayItemValue 847 } 848 849 type CustomizedImageSpec_FieldPathSelector int32 850 851 const ( 852 CustomizedImageSpec_FieldPathSelectorVersion CustomizedImageSpec_FieldPathSelector = 0 853 CustomizedImageSpec_FieldPathSelectorDeviceType CustomizedImageSpec_FieldPathSelector = 1 854 CustomizedImageSpec_FieldPathSelectorProvisioningPolicy CustomizedImageSpec_FieldPathSelector = 2 855 CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator CustomizedImageSpec_FieldPathSelector = 3 856 CustomizedImageSpec_FieldPathSelectorPassword CustomizedImageSpec_FieldPathSelector = 4 857 CustomizedImageSpec_FieldPathSelectorEncryption CustomizedImageSpec_FieldPathSelector = 5 858 CustomizedImageSpec_FieldPathSelectorEncryptionPassword CustomizedImageSpec_FieldPathSelector = 6 859 CustomizedImageSpec_FieldPathSelectorDiskMapping CustomizedImageSpec_FieldPathSelector = 7 860 CustomizedImageSpec_FieldPathSelectorNetworkAgent CustomizedImageSpec_FieldPathSelector = 8 861 CustomizedImageSpec_FieldPathSelectorNtp CustomizedImageSpec_FieldPathSelector = 9 862 CustomizedImageSpec_FieldPathSelectorHttpProxy CustomizedImageSpec_FieldPathSelector = 10 863 CustomizedImageSpec_FieldPathSelectorHttpsProxy CustomizedImageSpec_FieldPathSelector = 11 864 CustomizedImageSpec_FieldPathSelectorNoProxy CustomizedImageSpec_FieldPathSelector = 12 865 ) 866 867 func (s CustomizedImageSpec_FieldPathSelector) String() string { 868 switch s { 869 case CustomizedImageSpec_FieldPathSelectorVersion: 870 return "version" 871 case CustomizedImageSpec_FieldPathSelectorDeviceType: 872 return "device_type" 873 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 874 return "provisioning_policy" 875 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 876 return "install_ai_accelerator" 877 case CustomizedImageSpec_FieldPathSelectorPassword: 878 return "password" 879 case CustomizedImageSpec_FieldPathSelectorEncryption: 880 return "encryption" 881 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 882 return "encryption_password" 883 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 884 return "disk_mapping" 885 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 886 return "network_agent" 887 case CustomizedImageSpec_FieldPathSelectorNtp: 888 return "ntp" 889 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 890 return "http_proxy" 891 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 892 return "https_proxy" 893 case CustomizedImageSpec_FieldPathSelectorNoProxy: 894 return "no_proxy" 895 default: 896 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", s)) 897 } 898 } 899 900 func BuildCustomizedImageSpec_FieldPath(fp gotenobject.RawFieldPath) (CustomizedImageSpec_FieldPath, error) { 901 if len(fp) == 0 { 902 return nil, status.Error(codes.InvalidArgument, "empty field path for object CustomizedImage_Spec") 903 } 904 if len(fp) == 1 { 905 switch fp[0] { 906 case "version": 907 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorVersion}, nil 908 case "device_type", "deviceType", "device-type": 909 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorDeviceType}, nil 910 case "provisioning_policy", "provisioningPolicy", "provisioning-policy": 911 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorProvisioningPolicy}, nil 912 case "install_ai_accelerator", "installAiAccelerator", "install-ai-accelerator": 913 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator}, nil 914 case "password": 915 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorPassword}, nil 916 case "encryption": 917 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorEncryption}, nil 918 case "encryption_password", "encryptionPassword", "encryption-password": 919 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorEncryptionPassword}, nil 920 case "disk_mapping", "diskMapping", "disk-mapping": 921 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorDiskMapping}, nil 922 case "network_agent", "networkAgent", "network-agent": 923 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorNetworkAgent}, nil 924 case "ntp": 925 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorNtp}, nil 926 case "http_proxy", "httpProxy", "http-proxy": 927 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorHttpProxy}, nil 928 case "https_proxy", "httpsProxy", "https-proxy": 929 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorHttpsProxy}, nil 930 case "no_proxy", "noProxy", "no-proxy": 931 return &CustomizedImageSpec_FieldTerminalPath{selector: CustomizedImageSpec_FieldPathSelectorNoProxy}, nil 932 } 933 } 934 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object CustomizedImage_Spec", fp) 935 } 936 937 func ParseCustomizedImageSpec_FieldPath(rawField string) (CustomizedImageSpec_FieldPath, error) { 938 fp, err := gotenobject.ParseRawFieldPath(rawField) 939 if err != nil { 940 return nil, err 941 } 942 return BuildCustomizedImageSpec_FieldPath(fp) 943 } 944 945 func MustParseCustomizedImageSpec_FieldPath(rawField string) CustomizedImageSpec_FieldPath { 946 fp, err := ParseCustomizedImageSpec_FieldPath(rawField) 947 if err != nil { 948 panic(err) 949 } 950 return fp 951 } 952 953 type CustomizedImageSpec_FieldTerminalPath struct { 954 selector CustomizedImageSpec_FieldPathSelector 955 } 956 957 var _ CustomizedImageSpec_FieldPath = (*CustomizedImageSpec_FieldTerminalPath)(nil) 958 959 func (fp *CustomizedImageSpec_FieldTerminalPath) Selector() CustomizedImageSpec_FieldPathSelector { 960 return fp.selector 961 } 962 963 // String returns path representation in proto convention 964 func (fp *CustomizedImageSpec_FieldTerminalPath) String() string { 965 return fp.selector.String() 966 } 967 968 // JSONString returns path representation is JSON convention 969 func (fp *CustomizedImageSpec_FieldTerminalPath) JSONString() string { 970 return strcase.ToLowerCamel(fp.String()) 971 } 972 973 // Get returns all values pointed by specific field from source CustomizedImage_Spec 974 func (fp *CustomizedImageSpec_FieldTerminalPath) Get(source *CustomizedImage_Spec) (values []interface{}) { 975 if source != nil { 976 switch fp.selector { 977 case CustomizedImageSpec_FieldPathSelectorVersion: 978 values = append(values, source.Version) 979 case CustomizedImageSpec_FieldPathSelectorDeviceType: 980 values = append(values, source.DeviceType) 981 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 982 values = append(values, source.ProvisioningPolicy) 983 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 984 values = append(values, source.InstallAiAccelerator) 985 case CustomizedImageSpec_FieldPathSelectorPassword: 986 values = append(values, source.Password) 987 case CustomizedImageSpec_FieldPathSelectorEncryption: 988 values = append(values, source.Encryption) 989 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 990 values = append(values, source.EncryptionPassword) 991 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 992 values = append(values, source.DiskMapping) 993 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 994 values = append(values, source.NetworkAgent) 995 case CustomizedImageSpec_FieldPathSelectorNtp: 996 values = append(values, source.Ntp) 997 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 998 values = append(values, source.HttpProxy) 999 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 1000 values = append(values, source.HttpsProxy) 1001 case CustomizedImageSpec_FieldPathSelectorNoProxy: 1002 values = append(values, source.NoProxy) 1003 default: 1004 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", fp.selector)) 1005 } 1006 } 1007 return 1008 } 1009 1010 func (fp *CustomizedImageSpec_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1011 return fp.Get(source.(*CustomizedImage_Spec)) 1012 } 1013 1014 // GetSingle returns value pointed by specific field of from source CustomizedImage_Spec 1015 func (fp *CustomizedImageSpec_FieldTerminalPath) GetSingle(source *CustomizedImage_Spec) (interface{}, bool) { 1016 switch fp.selector { 1017 case CustomizedImageSpec_FieldPathSelectorVersion: 1018 return source.GetVersion(), source != nil 1019 case CustomizedImageSpec_FieldPathSelectorDeviceType: 1020 return source.GetDeviceType(), source != nil 1021 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 1022 return source.GetProvisioningPolicy(), source != nil 1023 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 1024 return source.GetInstallAiAccelerator(), source != nil 1025 case CustomizedImageSpec_FieldPathSelectorPassword: 1026 return source.GetPassword(), source != nil 1027 case CustomizedImageSpec_FieldPathSelectorEncryption: 1028 return source.GetEncryption(), source != nil 1029 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 1030 return source.GetEncryptionPassword(), source != nil 1031 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 1032 return source.GetDiskMapping(), source != nil 1033 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 1034 return source.GetNetworkAgent(), source != nil 1035 case CustomizedImageSpec_FieldPathSelectorNtp: 1036 return source.GetNtp(), source != nil 1037 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 1038 return source.GetHttpProxy(), source != nil 1039 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 1040 return source.GetHttpsProxy(), source != nil 1041 case CustomizedImageSpec_FieldPathSelectorNoProxy: 1042 return source.GetNoProxy(), source != nil 1043 default: 1044 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", fp.selector)) 1045 } 1046 } 1047 1048 func (fp *CustomizedImageSpec_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1049 return fp.GetSingle(source.(*CustomizedImage_Spec)) 1050 } 1051 1052 // GetDefault returns a default value of the field type 1053 func (fp *CustomizedImageSpec_FieldTerminalPath) GetDefault() interface{} { 1054 switch fp.selector { 1055 case CustomizedImageSpec_FieldPathSelectorVersion: 1056 return "" 1057 case CustomizedImageSpec_FieldPathSelectorDeviceType: 1058 return "" 1059 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 1060 return "" 1061 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 1062 return false 1063 case CustomizedImageSpec_FieldPathSelectorPassword: 1064 return "" 1065 case CustomizedImageSpec_FieldPathSelectorEncryption: 1066 return false 1067 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 1068 return "" 1069 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 1070 return "" 1071 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 1072 return "" 1073 case CustomizedImageSpec_FieldPathSelectorNtp: 1074 return "" 1075 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 1076 return "" 1077 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 1078 return "" 1079 case CustomizedImageSpec_FieldPathSelectorNoProxy: 1080 return "" 1081 default: 1082 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", fp.selector)) 1083 } 1084 } 1085 1086 func (fp *CustomizedImageSpec_FieldTerminalPath) ClearValue(item *CustomizedImage_Spec) { 1087 if item != nil { 1088 switch fp.selector { 1089 case CustomizedImageSpec_FieldPathSelectorVersion: 1090 item.Version = "" 1091 case CustomizedImageSpec_FieldPathSelectorDeviceType: 1092 item.DeviceType = "" 1093 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 1094 item.ProvisioningPolicy = "" 1095 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 1096 item.InstallAiAccelerator = false 1097 case CustomizedImageSpec_FieldPathSelectorPassword: 1098 item.Password = "" 1099 case CustomizedImageSpec_FieldPathSelectorEncryption: 1100 item.Encryption = false 1101 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 1102 item.EncryptionPassword = "" 1103 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 1104 item.DiskMapping = "" 1105 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 1106 item.NetworkAgent = "" 1107 case CustomizedImageSpec_FieldPathSelectorNtp: 1108 item.Ntp = "" 1109 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 1110 item.HttpProxy = "" 1111 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 1112 item.HttpsProxy = "" 1113 case CustomizedImageSpec_FieldPathSelectorNoProxy: 1114 item.NoProxy = "" 1115 default: 1116 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", fp.selector)) 1117 } 1118 } 1119 } 1120 1121 func (fp *CustomizedImageSpec_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1122 fp.ClearValue(item.(*CustomizedImage_Spec)) 1123 } 1124 1125 // IsLeaf - whether field path is holds simple value 1126 func (fp *CustomizedImageSpec_FieldTerminalPath) IsLeaf() bool { 1127 return fp.selector == CustomizedImageSpec_FieldPathSelectorVersion || 1128 fp.selector == CustomizedImageSpec_FieldPathSelectorDeviceType || 1129 fp.selector == CustomizedImageSpec_FieldPathSelectorProvisioningPolicy || 1130 fp.selector == CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator || 1131 fp.selector == CustomizedImageSpec_FieldPathSelectorPassword || 1132 fp.selector == CustomizedImageSpec_FieldPathSelectorEncryption || 1133 fp.selector == CustomizedImageSpec_FieldPathSelectorEncryptionPassword || 1134 fp.selector == CustomizedImageSpec_FieldPathSelectorDiskMapping || 1135 fp.selector == CustomizedImageSpec_FieldPathSelectorNetworkAgent || 1136 fp.selector == CustomizedImageSpec_FieldPathSelectorNtp || 1137 fp.selector == CustomizedImageSpec_FieldPathSelectorHttpProxy || 1138 fp.selector == CustomizedImageSpec_FieldPathSelectorHttpsProxy || 1139 fp.selector == CustomizedImageSpec_FieldPathSelectorNoProxy 1140 } 1141 1142 func (fp *CustomizedImageSpec_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1143 return []gotenobject.FieldPath{fp} 1144 } 1145 1146 func (fp *CustomizedImageSpec_FieldTerminalPath) WithIValue(value interface{}) CustomizedImageSpec_FieldPathValue { 1147 switch fp.selector { 1148 case CustomizedImageSpec_FieldPathSelectorVersion: 1149 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1150 case CustomizedImageSpec_FieldPathSelectorDeviceType: 1151 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1152 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 1153 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1154 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 1155 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(bool)} 1156 case CustomizedImageSpec_FieldPathSelectorPassword: 1157 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1158 case CustomizedImageSpec_FieldPathSelectorEncryption: 1159 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(bool)} 1160 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 1161 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1162 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 1163 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1164 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 1165 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1166 case CustomizedImageSpec_FieldPathSelectorNtp: 1167 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1168 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 1169 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1170 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 1171 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1172 case CustomizedImageSpec_FieldPathSelectorNoProxy: 1173 return &CustomizedImageSpec_FieldTerminalPathValue{CustomizedImageSpec_FieldTerminalPath: *fp, value: value.(string)} 1174 default: 1175 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", fp.selector)) 1176 } 1177 } 1178 1179 func (fp *CustomizedImageSpec_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1180 return fp.WithIValue(value) 1181 } 1182 1183 func (fp *CustomizedImageSpec_FieldTerminalPath) WithIArrayOfValues(values interface{}) CustomizedImageSpec_FieldPathArrayOfValues { 1184 fpaov := &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp} 1185 switch fp.selector { 1186 case CustomizedImageSpec_FieldPathSelectorVersion: 1187 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1188 case CustomizedImageSpec_FieldPathSelectorDeviceType: 1189 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1190 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 1191 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1192 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 1193 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]bool)} 1194 case CustomizedImageSpec_FieldPathSelectorPassword: 1195 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1196 case CustomizedImageSpec_FieldPathSelectorEncryption: 1197 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]bool)} 1198 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 1199 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1200 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 1201 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1202 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 1203 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1204 case CustomizedImageSpec_FieldPathSelectorNtp: 1205 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1206 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 1207 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1208 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 1209 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1210 case CustomizedImageSpec_FieldPathSelectorNoProxy: 1211 return &CustomizedImageSpec_FieldTerminalPathArrayOfValues{CustomizedImageSpec_FieldTerminalPath: *fp, values: values.([]string)} 1212 default: 1213 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", fp.selector)) 1214 } 1215 return fpaov 1216 } 1217 1218 func (fp *CustomizedImageSpec_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1219 return fp.WithIArrayOfValues(values) 1220 } 1221 1222 func (fp *CustomizedImageSpec_FieldTerminalPath) WithIArrayItemValue(value interface{}) CustomizedImageSpec_FieldPathArrayItemValue { 1223 switch fp.selector { 1224 default: 1225 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", fp.selector)) 1226 } 1227 } 1228 1229 func (fp *CustomizedImageSpec_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1230 return fp.WithIArrayItemValue(value) 1231 } 1232 1233 // CustomizedImageSpec_FieldPathValue allows storing values for Spec fields according to their type 1234 type CustomizedImageSpec_FieldPathValue interface { 1235 CustomizedImageSpec_FieldPath 1236 gotenobject.FieldPathValue 1237 SetTo(target **CustomizedImage_Spec) 1238 CompareWith(*CustomizedImage_Spec) (cmp int, comparable bool) 1239 } 1240 1241 func ParseCustomizedImageSpec_FieldPathValue(pathStr, valueStr string) (CustomizedImageSpec_FieldPathValue, error) { 1242 fp, err := ParseCustomizedImageSpec_FieldPath(pathStr) 1243 if err != nil { 1244 return nil, err 1245 } 1246 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1247 if err != nil { 1248 return nil, status.Errorf(codes.InvalidArgument, "error parsing Spec field path value from %s: %v", valueStr, err) 1249 } 1250 return fpv.(CustomizedImageSpec_FieldPathValue), nil 1251 } 1252 1253 func MustParseCustomizedImageSpec_FieldPathValue(pathStr, valueStr string) CustomizedImageSpec_FieldPathValue { 1254 fpv, err := ParseCustomizedImageSpec_FieldPathValue(pathStr, valueStr) 1255 if err != nil { 1256 panic(err) 1257 } 1258 return fpv 1259 } 1260 1261 type CustomizedImageSpec_FieldTerminalPathValue struct { 1262 CustomizedImageSpec_FieldTerminalPath 1263 value interface{} 1264 } 1265 1266 var _ CustomizedImageSpec_FieldPathValue = (*CustomizedImageSpec_FieldTerminalPathValue)(nil) 1267 1268 // GetRawValue returns raw value stored under selected path for 'Spec' as interface{} 1269 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) GetRawValue() interface{} { 1270 return fpv.value 1271 } 1272 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsVersionValue() (string, bool) { 1273 res, ok := fpv.value.(string) 1274 return res, ok 1275 } 1276 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsDeviceTypeValue() (string, bool) { 1277 res, ok := fpv.value.(string) 1278 return res, ok 1279 } 1280 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsProvisioningPolicyValue() (string, bool) { 1281 res, ok := fpv.value.(string) 1282 return res, ok 1283 } 1284 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsInstallAiAcceleratorValue() (bool, bool) { 1285 res, ok := fpv.value.(bool) 1286 return res, ok 1287 } 1288 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsPasswordValue() (string, bool) { 1289 res, ok := fpv.value.(string) 1290 return res, ok 1291 } 1292 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsEncryptionValue() (bool, bool) { 1293 res, ok := fpv.value.(bool) 1294 return res, ok 1295 } 1296 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsEncryptionPasswordValue() (string, bool) { 1297 res, ok := fpv.value.(string) 1298 return res, ok 1299 } 1300 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsDiskMappingValue() (string, bool) { 1301 res, ok := fpv.value.(string) 1302 return res, ok 1303 } 1304 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsNetworkAgentValue() (string, bool) { 1305 res, ok := fpv.value.(string) 1306 return res, ok 1307 } 1308 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsNtpValue() (string, bool) { 1309 res, ok := fpv.value.(string) 1310 return res, ok 1311 } 1312 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsHttpProxyValue() (string, bool) { 1313 res, ok := fpv.value.(string) 1314 return res, ok 1315 } 1316 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsHttpsProxyValue() (string, bool) { 1317 res, ok := fpv.value.(string) 1318 return res, ok 1319 } 1320 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) AsNoProxyValue() (string, bool) { 1321 res, ok := fpv.value.(string) 1322 return res, ok 1323 } 1324 1325 // SetTo stores value for selected field for object Spec 1326 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) SetTo(target **CustomizedImage_Spec) { 1327 if *target == nil { 1328 *target = new(CustomizedImage_Spec) 1329 } 1330 switch fpv.selector { 1331 case CustomizedImageSpec_FieldPathSelectorVersion: 1332 (*target).Version = fpv.value.(string) 1333 case CustomizedImageSpec_FieldPathSelectorDeviceType: 1334 (*target).DeviceType = fpv.value.(string) 1335 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 1336 (*target).ProvisioningPolicy = fpv.value.(string) 1337 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 1338 (*target).InstallAiAccelerator = fpv.value.(bool) 1339 case CustomizedImageSpec_FieldPathSelectorPassword: 1340 (*target).Password = fpv.value.(string) 1341 case CustomizedImageSpec_FieldPathSelectorEncryption: 1342 (*target).Encryption = fpv.value.(bool) 1343 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 1344 (*target).EncryptionPassword = fpv.value.(string) 1345 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 1346 (*target).DiskMapping = fpv.value.(string) 1347 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 1348 (*target).NetworkAgent = fpv.value.(string) 1349 case CustomizedImageSpec_FieldPathSelectorNtp: 1350 (*target).Ntp = fpv.value.(string) 1351 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 1352 (*target).HttpProxy = fpv.value.(string) 1353 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 1354 (*target).HttpsProxy = fpv.value.(string) 1355 case CustomizedImageSpec_FieldPathSelectorNoProxy: 1356 (*target).NoProxy = fpv.value.(string) 1357 default: 1358 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", fpv.selector)) 1359 } 1360 } 1361 1362 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) SetToRaw(target proto.Message) { 1363 typedObject := target.(*CustomizedImage_Spec) 1364 fpv.SetTo(&typedObject) 1365 } 1366 1367 // CompareWith compares value in the 'CustomizedImageSpec_FieldTerminalPathValue' with the value under path in 'CustomizedImage_Spec'. 1368 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) CompareWith(source *CustomizedImage_Spec) (int, bool) { 1369 switch fpv.selector { 1370 case CustomizedImageSpec_FieldPathSelectorVersion: 1371 leftValue := fpv.value.(string) 1372 rightValue := source.GetVersion() 1373 if (leftValue) == (rightValue) { 1374 return 0, true 1375 } else if (leftValue) < (rightValue) { 1376 return -1, true 1377 } else { 1378 return 1, true 1379 } 1380 case CustomizedImageSpec_FieldPathSelectorDeviceType: 1381 leftValue := fpv.value.(string) 1382 rightValue := source.GetDeviceType() 1383 if (leftValue) == (rightValue) { 1384 return 0, true 1385 } else if (leftValue) < (rightValue) { 1386 return -1, true 1387 } else { 1388 return 1, true 1389 } 1390 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 1391 leftValue := fpv.value.(string) 1392 rightValue := source.GetProvisioningPolicy() 1393 if (leftValue) == (rightValue) { 1394 return 0, true 1395 } else if (leftValue) < (rightValue) { 1396 return -1, true 1397 } else { 1398 return 1, true 1399 } 1400 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 1401 leftValue := fpv.value.(bool) 1402 rightValue := source.GetInstallAiAccelerator() 1403 if (leftValue) == (rightValue) { 1404 return 0, true 1405 } else if !(leftValue) && (rightValue) { 1406 return -1, true 1407 } else { 1408 return 1, true 1409 } 1410 case CustomizedImageSpec_FieldPathSelectorPassword: 1411 leftValue := fpv.value.(string) 1412 rightValue := source.GetPassword() 1413 if (leftValue) == (rightValue) { 1414 return 0, true 1415 } else if (leftValue) < (rightValue) { 1416 return -1, true 1417 } else { 1418 return 1, true 1419 } 1420 case CustomizedImageSpec_FieldPathSelectorEncryption: 1421 leftValue := fpv.value.(bool) 1422 rightValue := source.GetEncryption() 1423 if (leftValue) == (rightValue) { 1424 return 0, true 1425 } else if !(leftValue) && (rightValue) { 1426 return -1, true 1427 } else { 1428 return 1, true 1429 } 1430 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 1431 leftValue := fpv.value.(string) 1432 rightValue := source.GetEncryptionPassword() 1433 if (leftValue) == (rightValue) { 1434 return 0, true 1435 } else if (leftValue) < (rightValue) { 1436 return -1, true 1437 } else { 1438 return 1, true 1439 } 1440 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 1441 leftValue := fpv.value.(string) 1442 rightValue := source.GetDiskMapping() 1443 if (leftValue) == (rightValue) { 1444 return 0, true 1445 } else if (leftValue) < (rightValue) { 1446 return -1, true 1447 } else { 1448 return 1, true 1449 } 1450 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 1451 leftValue := fpv.value.(string) 1452 rightValue := source.GetNetworkAgent() 1453 if (leftValue) == (rightValue) { 1454 return 0, true 1455 } else if (leftValue) < (rightValue) { 1456 return -1, true 1457 } else { 1458 return 1, true 1459 } 1460 case CustomizedImageSpec_FieldPathSelectorNtp: 1461 leftValue := fpv.value.(string) 1462 rightValue := source.GetNtp() 1463 if (leftValue) == (rightValue) { 1464 return 0, true 1465 } else if (leftValue) < (rightValue) { 1466 return -1, true 1467 } else { 1468 return 1, true 1469 } 1470 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 1471 leftValue := fpv.value.(string) 1472 rightValue := source.GetHttpProxy() 1473 if (leftValue) == (rightValue) { 1474 return 0, true 1475 } else if (leftValue) < (rightValue) { 1476 return -1, true 1477 } else { 1478 return 1, true 1479 } 1480 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 1481 leftValue := fpv.value.(string) 1482 rightValue := source.GetHttpsProxy() 1483 if (leftValue) == (rightValue) { 1484 return 0, true 1485 } else if (leftValue) < (rightValue) { 1486 return -1, true 1487 } else { 1488 return 1, true 1489 } 1490 case CustomizedImageSpec_FieldPathSelectorNoProxy: 1491 leftValue := fpv.value.(string) 1492 rightValue := source.GetNoProxy() 1493 if (leftValue) == (rightValue) { 1494 return 0, true 1495 } else if (leftValue) < (rightValue) { 1496 return -1, true 1497 } else { 1498 return 1, true 1499 } 1500 default: 1501 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Spec: %d", fpv.selector)) 1502 } 1503 } 1504 1505 func (fpv *CustomizedImageSpec_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 1506 return fpv.CompareWith(source.(*CustomizedImage_Spec)) 1507 } 1508 1509 // CustomizedImageSpec_FieldPathArrayItemValue allows storing single item in Path-specific values for Spec according to their type 1510 // Present only for array (repeated) types. 1511 type CustomizedImageSpec_FieldPathArrayItemValue interface { 1512 gotenobject.FieldPathArrayItemValue 1513 CustomizedImageSpec_FieldPath 1514 ContainsValue(*CustomizedImage_Spec) bool 1515 } 1516 1517 // ParseCustomizedImageSpec_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 1518 func ParseCustomizedImageSpec_FieldPathArrayItemValue(pathStr, valueStr string) (CustomizedImageSpec_FieldPathArrayItemValue, error) { 1519 fp, err := ParseCustomizedImageSpec_FieldPath(pathStr) 1520 if err != nil { 1521 return nil, err 1522 } 1523 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 1524 if err != nil { 1525 return nil, status.Errorf(codes.InvalidArgument, "error parsing Spec field path array item value from %s: %v", valueStr, err) 1526 } 1527 return fpaiv.(CustomizedImageSpec_FieldPathArrayItemValue), nil 1528 } 1529 1530 func MustParseCustomizedImageSpec_FieldPathArrayItemValue(pathStr, valueStr string) CustomizedImageSpec_FieldPathArrayItemValue { 1531 fpaiv, err := ParseCustomizedImageSpec_FieldPathArrayItemValue(pathStr, valueStr) 1532 if err != nil { 1533 panic(err) 1534 } 1535 return fpaiv 1536 } 1537 1538 type CustomizedImageSpec_FieldTerminalPathArrayItemValue struct { 1539 CustomizedImageSpec_FieldTerminalPath 1540 value interface{} 1541 } 1542 1543 var _ CustomizedImageSpec_FieldPathArrayItemValue = (*CustomizedImageSpec_FieldTerminalPathArrayItemValue)(nil) 1544 1545 // GetRawValue returns stored element value for array in object CustomizedImage_Spec as interface{} 1546 func (fpaiv *CustomizedImageSpec_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 1547 return fpaiv.value 1548 } 1549 1550 func (fpaiv *CustomizedImageSpec_FieldTerminalPathArrayItemValue) GetSingle(source *CustomizedImage_Spec) (interface{}, bool) { 1551 return nil, false 1552 } 1553 1554 func (fpaiv *CustomizedImageSpec_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 1555 return fpaiv.GetSingle(source.(*CustomizedImage_Spec)) 1556 } 1557 1558 // Contains returns a boolean indicating if value that is being held is present in given 'Spec' 1559 func (fpaiv *CustomizedImageSpec_FieldTerminalPathArrayItemValue) ContainsValue(source *CustomizedImage_Spec) bool { 1560 slice := fpaiv.CustomizedImageSpec_FieldTerminalPath.Get(source) 1561 for _, v := range slice { 1562 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 1563 if proto.Equal(asProtoMsg, v.(proto.Message)) { 1564 return true 1565 } 1566 } else if reflect.DeepEqual(v, fpaiv.value) { 1567 return true 1568 } 1569 } 1570 return false 1571 } 1572 1573 // CustomizedImageSpec_FieldPathArrayOfValues allows storing slice of values for Spec fields according to their type 1574 type CustomizedImageSpec_FieldPathArrayOfValues interface { 1575 gotenobject.FieldPathArrayOfValues 1576 CustomizedImageSpec_FieldPath 1577 } 1578 1579 func ParseCustomizedImageSpec_FieldPathArrayOfValues(pathStr, valuesStr string) (CustomizedImageSpec_FieldPathArrayOfValues, error) { 1580 fp, err := ParseCustomizedImageSpec_FieldPath(pathStr) 1581 if err != nil { 1582 return nil, err 1583 } 1584 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 1585 if err != nil { 1586 return nil, status.Errorf(codes.InvalidArgument, "error parsing Spec field path array of values from %s: %v", valuesStr, err) 1587 } 1588 return fpaov.(CustomizedImageSpec_FieldPathArrayOfValues), nil 1589 } 1590 1591 func MustParseCustomizedImageSpec_FieldPathArrayOfValues(pathStr, valuesStr string) CustomizedImageSpec_FieldPathArrayOfValues { 1592 fpaov, err := ParseCustomizedImageSpec_FieldPathArrayOfValues(pathStr, valuesStr) 1593 if err != nil { 1594 panic(err) 1595 } 1596 return fpaov 1597 } 1598 1599 type CustomizedImageSpec_FieldTerminalPathArrayOfValues struct { 1600 CustomizedImageSpec_FieldTerminalPath 1601 values interface{} 1602 } 1603 1604 var _ CustomizedImageSpec_FieldPathArrayOfValues = (*CustomizedImageSpec_FieldTerminalPathArrayOfValues)(nil) 1605 1606 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 1607 switch fpaov.selector { 1608 case CustomizedImageSpec_FieldPathSelectorVersion: 1609 for _, v := range fpaov.values.([]string) { 1610 values = append(values, v) 1611 } 1612 case CustomizedImageSpec_FieldPathSelectorDeviceType: 1613 for _, v := range fpaov.values.([]string) { 1614 values = append(values, v) 1615 } 1616 case CustomizedImageSpec_FieldPathSelectorProvisioningPolicy: 1617 for _, v := range fpaov.values.([]string) { 1618 values = append(values, v) 1619 } 1620 case CustomizedImageSpec_FieldPathSelectorInstallAiAccelerator: 1621 for _, v := range fpaov.values.([]bool) { 1622 values = append(values, v) 1623 } 1624 case CustomizedImageSpec_FieldPathSelectorPassword: 1625 for _, v := range fpaov.values.([]string) { 1626 values = append(values, v) 1627 } 1628 case CustomizedImageSpec_FieldPathSelectorEncryption: 1629 for _, v := range fpaov.values.([]bool) { 1630 values = append(values, v) 1631 } 1632 case CustomizedImageSpec_FieldPathSelectorEncryptionPassword: 1633 for _, v := range fpaov.values.([]string) { 1634 values = append(values, v) 1635 } 1636 case CustomizedImageSpec_FieldPathSelectorDiskMapping: 1637 for _, v := range fpaov.values.([]string) { 1638 values = append(values, v) 1639 } 1640 case CustomizedImageSpec_FieldPathSelectorNetworkAgent: 1641 for _, v := range fpaov.values.([]string) { 1642 values = append(values, v) 1643 } 1644 case CustomizedImageSpec_FieldPathSelectorNtp: 1645 for _, v := range fpaov.values.([]string) { 1646 values = append(values, v) 1647 } 1648 case CustomizedImageSpec_FieldPathSelectorHttpProxy: 1649 for _, v := range fpaov.values.([]string) { 1650 values = append(values, v) 1651 } 1652 case CustomizedImageSpec_FieldPathSelectorHttpsProxy: 1653 for _, v := range fpaov.values.([]string) { 1654 values = append(values, v) 1655 } 1656 case CustomizedImageSpec_FieldPathSelectorNoProxy: 1657 for _, v := range fpaov.values.([]string) { 1658 values = append(values, v) 1659 } 1660 } 1661 return 1662 } 1663 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsVersionArrayOfValues() ([]string, bool) { 1664 res, ok := fpaov.values.([]string) 1665 return res, ok 1666 } 1667 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsDeviceTypeArrayOfValues() ([]string, bool) { 1668 res, ok := fpaov.values.([]string) 1669 return res, ok 1670 } 1671 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsProvisioningPolicyArrayOfValues() ([]string, bool) { 1672 res, ok := fpaov.values.([]string) 1673 return res, ok 1674 } 1675 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsInstallAiAcceleratorArrayOfValues() ([]bool, bool) { 1676 res, ok := fpaov.values.([]bool) 1677 return res, ok 1678 } 1679 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsPasswordArrayOfValues() ([]string, bool) { 1680 res, ok := fpaov.values.([]string) 1681 return res, ok 1682 } 1683 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsEncryptionArrayOfValues() ([]bool, bool) { 1684 res, ok := fpaov.values.([]bool) 1685 return res, ok 1686 } 1687 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsEncryptionPasswordArrayOfValues() ([]string, bool) { 1688 res, ok := fpaov.values.([]string) 1689 return res, ok 1690 } 1691 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsDiskMappingArrayOfValues() ([]string, bool) { 1692 res, ok := fpaov.values.([]string) 1693 return res, ok 1694 } 1695 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsNetworkAgentArrayOfValues() ([]string, bool) { 1696 res, ok := fpaov.values.([]string) 1697 return res, ok 1698 } 1699 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsNtpArrayOfValues() ([]string, bool) { 1700 res, ok := fpaov.values.([]string) 1701 return res, ok 1702 } 1703 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsHttpProxyArrayOfValues() ([]string, bool) { 1704 res, ok := fpaov.values.([]string) 1705 return res, ok 1706 } 1707 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsHttpsProxyArrayOfValues() ([]string, bool) { 1708 res, ok := fpaov.values.([]string) 1709 return res, ok 1710 } 1711 func (fpaov *CustomizedImageSpec_FieldTerminalPathArrayOfValues) AsNoProxyArrayOfValues() ([]string, bool) { 1712 res, ok := fpaov.values.([]string) 1713 return res, ok 1714 } 1715 1716 // FieldPath provides implementation to handle 1717 // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto 1718 type CustomizedImageStatus_FieldPath interface { 1719 gotenobject.FieldPath 1720 Selector() CustomizedImageStatus_FieldPathSelector 1721 Get(source *CustomizedImage_Status) []interface{} 1722 GetSingle(source *CustomizedImage_Status) (interface{}, bool) 1723 ClearValue(item *CustomizedImage_Status) 1724 1725 // Those methods build corresponding CustomizedImageStatus_FieldPathValue 1726 // (or array of values) and holds passed value. Panics if injected type is incorrect. 1727 WithIValue(value interface{}) CustomizedImageStatus_FieldPathValue 1728 WithIArrayOfValues(values interface{}) CustomizedImageStatus_FieldPathArrayOfValues 1729 WithIArrayItemValue(value interface{}) CustomizedImageStatus_FieldPathArrayItemValue 1730 } 1731 1732 type CustomizedImageStatus_FieldPathSelector int32 1733 1734 const ( 1735 CustomizedImageStatus_FieldPathSelectorState CustomizedImageStatus_FieldPathSelector = 0 1736 CustomizedImageStatus_FieldPathSelectorLog CustomizedImageStatus_FieldPathSelector = 1 1737 CustomizedImageStatus_FieldPathSelectorFile CustomizedImageStatus_FieldPathSelector = 2 1738 ) 1739 1740 func (s CustomizedImageStatus_FieldPathSelector) String() string { 1741 switch s { 1742 case CustomizedImageStatus_FieldPathSelectorState: 1743 return "state" 1744 case CustomizedImageStatus_FieldPathSelectorLog: 1745 return "log" 1746 case CustomizedImageStatus_FieldPathSelectorFile: 1747 return "file" 1748 default: 1749 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", s)) 1750 } 1751 } 1752 1753 func BuildCustomizedImageStatus_FieldPath(fp gotenobject.RawFieldPath) (CustomizedImageStatus_FieldPath, error) { 1754 if len(fp) == 0 { 1755 return nil, status.Error(codes.InvalidArgument, "empty field path for object CustomizedImage_Status") 1756 } 1757 if len(fp) == 1 { 1758 switch fp[0] { 1759 case "state": 1760 return &CustomizedImageStatus_FieldTerminalPath{selector: CustomizedImageStatus_FieldPathSelectorState}, nil 1761 case "log": 1762 return &CustomizedImageStatus_FieldTerminalPath{selector: CustomizedImageStatus_FieldPathSelectorLog}, nil 1763 case "file": 1764 return &CustomizedImageStatus_FieldTerminalPath{selector: CustomizedImageStatus_FieldPathSelectorFile}, nil 1765 } 1766 } 1767 return nil, status.Errorf(codes.InvalidArgument, "unknown field path '%s' for object CustomizedImage_Status", fp) 1768 } 1769 1770 func ParseCustomizedImageStatus_FieldPath(rawField string) (CustomizedImageStatus_FieldPath, error) { 1771 fp, err := gotenobject.ParseRawFieldPath(rawField) 1772 if err != nil { 1773 return nil, err 1774 } 1775 return BuildCustomizedImageStatus_FieldPath(fp) 1776 } 1777 1778 func MustParseCustomizedImageStatus_FieldPath(rawField string) CustomizedImageStatus_FieldPath { 1779 fp, err := ParseCustomizedImageStatus_FieldPath(rawField) 1780 if err != nil { 1781 panic(err) 1782 } 1783 return fp 1784 } 1785 1786 type CustomizedImageStatus_FieldTerminalPath struct { 1787 selector CustomizedImageStatus_FieldPathSelector 1788 } 1789 1790 var _ CustomizedImageStatus_FieldPath = (*CustomizedImageStatus_FieldTerminalPath)(nil) 1791 1792 func (fp *CustomizedImageStatus_FieldTerminalPath) Selector() CustomizedImageStatus_FieldPathSelector { 1793 return fp.selector 1794 } 1795 1796 // String returns path representation in proto convention 1797 func (fp *CustomizedImageStatus_FieldTerminalPath) String() string { 1798 return fp.selector.String() 1799 } 1800 1801 // JSONString returns path representation is JSON convention 1802 func (fp *CustomizedImageStatus_FieldTerminalPath) JSONString() string { 1803 return strcase.ToLowerCamel(fp.String()) 1804 } 1805 1806 // Get returns all values pointed by specific field from source CustomizedImage_Status 1807 func (fp *CustomizedImageStatus_FieldTerminalPath) Get(source *CustomizedImage_Status) (values []interface{}) { 1808 if source != nil { 1809 switch fp.selector { 1810 case CustomizedImageStatus_FieldPathSelectorState: 1811 values = append(values, source.State) 1812 case CustomizedImageStatus_FieldPathSelectorLog: 1813 values = append(values, source.Log) 1814 case CustomizedImageStatus_FieldPathSelectorFile: 1815 values = append(values, source.File) 1816 default: 1817 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", fp.selector)) 1818 } 1819 } 1820 return 1821 } 1822 1823 func (fp *CustomizedImageStatus_FieldTerminalPath) GetRaw(source proto.Message) []interface{} { 1824 return fp.Get(source.(*CustomizedImage_Status)) 1825 } 1826 1827 // GetSingle returns value pointed by specific field of from source CustomizedImage_Status 1828 func (fp *CustomizedImageStatus_FieldTerminalPath) GetSingle(source *CustomizedImage_Status) (interface{}, bool) { 1829 switch fp.selector { 1830 case CustomizedImageStatus_FieldPathSelectorState: 1831 return source.GetState(), source != nil 1832 case CustomizedImageStatus_FieldPathSelectorLog: 1833 return source.GetLog(), source != nil 1834 case CustomizedImageStatus_FieldPathSelectorFile: 1835 return source.GetFile(), source != nil 1836 default: 1837 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", fp.selector)) 1838 } 1839 } 1840 1841 func (fp *CustomizedImageStatus_FieldTerminalPath) GetSingleRaw(source proto.Message) (interface{}, bool) { 1842 return fp.GetSingle(source.(*CustomizedImage_Status)) 1843 } 1844 1845 // GetDefault returns a default value of the field type 1846 func (fp *CustomizedImageStatus_FieldTerminalPath) GetDefault() interface{} { 1847 switch fp.selector { 1848 case CustomizedImageStatus_FieldPathSelectorState: 1849 return CustomizedImage_Status_STATE_UNSPECIFIED 1850 case CustomizedImageStatus_FieldPathSelectorLog: 1851 return "" 1852 case CustomizedImageStatus_FieldPathSelectorFile: 1853 return "" 1854 default: 1855 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", fp.selector)) 1856 } 1857 } 1858 1859 func (fp *CustomizedImageStatus_FieldTerminalPath) ClearValue(item *CustomizedImage_Status) { 1860 if item != nil { 1861 switch fp.selector { 1862 case CustomizedImageStatus_FieldPathSelectorState: 1863 item.State = CustomizedImage_Status_STATE_UNSPECIFIED 1864 case CustomizedImageStatus_FieldPathSelectorLog: 1865 item.Log = "" 1866 case CustomizedImageStatus_FieldPathSelectorFile: 1867 item.File = "" 1868 default: 1869 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", fp.selector)) 1870 } 1871 } 1872 } 1873 1874 func (fp *CustomizedImageStatus_FieldTerminalPath) ClearValueRaw(item proto.Message) { 1875 fp.ClearValue(item.(*CustomizedImage_Status)) 1876 } 1877 1878 // IsLeaf - whether field path is holds simple value 1879 func (fp *CustomizedImageStatus_FieldTerminalPath) IsLeaf() bool { 1880 return fp.selector == CustomizedImageStatus_FieldPathSelectorState || 1881 fp.selector == CustomizedImageStatus_FieldPathSelectorLog || 1882 fp.selector == CustomizedImageStatus_FieldPathSelectorFile 1883 } 1884 1885 func (fp *CustomizedImageStatus_FieldTerminalPath) SplitIntoTerminalIPaths() []gotenobject.FieldPath { 1886 return []gotenobject.FieldPath{fp} 1887 } 1888 1889 func (fp *CustomizedImageStatus_FieldTerminalPath) WithIValue(value interface{}) CustomizedImageStatus_FieldPathValue { 1890 switch fp.selector { 1891 case CustomizedImageStatus_FieldPathSelectorState: 1892 return &CustomizedImageStatus_FieldTerminalPathValue{CustomizedImageStatus_FieldTerminalPath: *fp, value: value.(CustomizedImage_Status_State)} 1893 case CustomizedImageStatus_FieldPathSelectorLog: 1894 return &CustomizedImageStatus_FieldTerminalPathValue{CustomizedImageStatus_FieldTerminalPath: *fp, value: value.(string)} 1895 case CustomizedImageStatus_FieldPathSelectorFile: 1896 return &CustomizedImageStatus_FieldTerminalPathValue{CustomizedImageStatus_FieldTerminalPath: *fp, value: value.(string)} 1897 default: 1898 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", fp.selector)) 1899 } 1900 } 1901 1902 func (fp *CustomizedImageStatus_FieldTerminalPath) WithRawIValue(value interface{}) gotenobject.FieldPathValue { 1903 return fp.WithIValue(value) 1904 } 1905 1906 func (fp *CustomizedImageStatus_FieldTerminalPath) WithIArrayOfValues(values interface{}) CustomizedImageStatus_FieldPathArrayOfValues { 1907 fpaov := &CustomizedImageStatus_FieldTerminalPathArrayOfValues{CustomizedImageStatus_FieldTerminalPath: *fp} 1908 switch fp.selector { 1909 case CustomizedImageStatus_FieldPathSelectorState: 1910 return &CustomizedImageStatus_FieldTerminalPathArrayOfValues{CustomizedImageStatus_FieldTerminalPath: *fp, values: values.([]CustomizedImage_Status_State)} 1911 case CustomizedImageStatus_FieldPathSelectorLog: 1912 return &CustomizedImageStatus_FieldTerminalPathArrayOfValues{CustomizedImageStatus_FieldTerminalPath: *fp, values: values.([]string)} 1913 case CustomizedImageStatus_FieldPathSelectorFile: 1914 return &CustomizedImageStatus_FieldTerminalPathArrayOfValues{CustomizedImageStatus_FieldTerminalPath: *fp, values: values.([]string)} 1915 default: 1916 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", fp.selector)) 1917 } 1918 return fpaov 1919 } 1920 1921 func (fp *CustomizedImageStatus_FieldTerminalPath) WithRawIArrayOfValues(values interface{}) gotenobject.FieldPathArrayOfValues { 1922 return fp.WithIArrayOfValues(values) 1923 } 1924 1925 func (fp *CustomizedImageStatus_FieldTerminalPath) WithIArrayItemValue(value interface{}) CustomizedImageStatus_FieldPathArrayItemValue { 1926 switch fp.selector { 1927 default: 1928 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", fp.selector)) 1929 } 1930 } 1931 1932 func (fp *CustomizedImageStatus_FieldTerminalPath) WithRawIArrayItemValue(value interface{}) gotenobject.FieldPathArrayItemValue { 1933 return fp.WithIArrayItemValue(value) 1934 } 1935 1936 // CustomizedImageStatus_FieldPathValue allows storing values for Status fields according to their type 1937 type CustomizedImageStatus_FieldPathValue interface { 1938 CustomizedImageStatus_FieldPath 1939 gotenobject.FieldPathValue 1940 SetTo(target **CustomizedImage_Status) 1941 CompareWith(*CustomizedImage_Status) (cmp int, comparable bool) 1942 } 1943 1944 func ParseCustomizedImageStatus_FieldPathValue(pathStr, valueStr string) (CustomizedImageStatus_FieldPathValue, error) { 1945 fp, err := ParseCustomizedImageStatus_FieldPath(pathStr) 1946 if err != nil { 1947 return nil, err 1948 } 1949 fpv, err := gotenobject.ParseFieldPathValue(fp, valueStr) 1950 if err != nil { 1951 return nil, status.Errorf(codes.InvalidArgument, "error parsing Status field path value from %s: %v", valueStr, err) 1952 } 1953 return fpv.(CustomizedImageStatus_FieldPathValue), nil 1954 } 1955 1956 func MustParseCustomizedImageStatus_FieldPathValue(pathStr, valueStr string) CustomizedImageStatus_FieldPathValue { 1957 fpv, err := ParseCustomizedImageStatus_FieldPathValue(pathStr, valueStr) 1958 if err != nil { 1959 panic(err) 1960 } 1961 return fpv 1962 } 1963 1964 type CustomizedImageStatus_FieldTerminalPathValue struct { 1965 CustomizedImageStatus_FieldTerminalPath 1966 value interface{} 1967 } 1968 1969 var _ CustomizedImageStatus_FieldPathValue = (*CustomizedImageStatus_FieldTerminalPathValue)(nil) 1970 1971 // GetRawValue returns raw value stored under selected path for 'Status' as interface{} 1972 func (fpv *CustomizedImageStatus_FieldTerminalPathValue) GetRawValue() interface{} { 1973 return fpv.value 1974 } 1975 func (fpv *CustomizedImageStatus_FieldTerminalPathValue) AsStateValue() (CustomizedImage_Status_State, bool) { 1976 res, ok := fpv.value.(CustomizedImage_Status_State) 1977 return res, ok 1978 } 1979 func (fpv *CustomizedImageStatus_FieldTerminalPathValue) AsLogValue() (string, bool) { 1980 res, ok := fpv.value.(string) 1981 return res, ok 1982 } 1983 func (fpv *CustomizedImageStatus_FieldTerminalPathValue) AsFileValue() (string, bool) { 1984 res, ok := fpv.value.(string) 1985 return res, ok 1986 } 1987 1988 // SetTo stores value for selected field for object Status 1989 func (fpv *CustomizedImageStatus_FieldTerminalPathValue) SetTo(target **CustomizedImage_Status) { 1990 if *target == nil { 1991 *target = new(CustomizedImage_Status) 1992 } 1993 switch fpv.selector { 1994 case CustomizedImageStatus_FieldPathSelectorState: 1995 (*target).State = fpv.value.(CustomizedImage_Status_State) 1996 case CustomizedImageStatus_FieldPathSelectorLog: 1997 (*target).Log = fpv.value.(string) 1998 case CustomizedImageStatus_FieldPathSelectorFile: 1999 (*target).File = fpv.value.(string) 2000 default: 2001 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", fpv.selector)) 2002 } 2003 } 2004 2005 func (fpv *CustomizedImageStatus_FieldTerminalPathValue) SetToRaw(target proto.Message) { 2006 typedObject := target.(*CustomizedImage_Status) 2007 fpv.SetTo(&typedObject) 2008 } 2009 2010 // CompareWith compares value in the 'CustomizedImageStatus_FieldTerminalPathValue' with the value under path in 'CustomizedImage_Status'. 2011 func (fpv *CustomizedImageStatus_FieldTerminalPathValue) CompareWith(source *CustomizedImage_Status) (int, bool) { 2012 switch fpv.selector { 2013 case CustomizedImageStatus_FieldPathSelectorState: 2014 leftValue := fpv.value.(CustomizedImage_Status_State) 2015 rightValue := source.GetState() 2016 if (leftValue) == (rightValue) { 2017 return 0, true 2018 } else if (leftValue) < (rightValue) { 2019 return -1, true 2020 } else { 2021 return 1, true 2022 } 2023 case CustomizedImageStatus_FieldPathSelectorLog: 2024 leftValue := fpv.value.(string) 2025 rightValue := source.GetLog() 2026 if (leftValue) == (rightValue) { 2027 return 0, true 2028 } else if (leftValue) < (rightValue) { 2029 return -1, true 2030 } else { 2031 return 1, true 2032 } 2033 case CustomizedImageStatus_FieldPathSelectorFile: 2034 leftValue := fpv.value.(string) 2035 rightValue := source.GetFile() 2036 if (leftValue) == (rightValue) { 2037 return 0, true 2038 } else if (leftValue) < (rightValue) { 2039 return -1, true 2040 } else { 2041 return 1, true 2042 } 2043 default: 2044 panic(fmt.Sprintf("Invalid selector for CustomizedImage_Status: %d", fpv.selector)) 2045 } 2046 } 2047 2048 func (fpv *CustomizedImageStatus_FieldTerminalPathValue) CompareWithRaw(source proto.Message) (int, bool) { 2049 return fpv.CompareWith(source.(*CustomizedImage_Status)) 2050 } 2051 2052 // CustomizedImageStatus_FieldPathArrayItemValue allows storing single item in Path-specific values for Status according to their type 2053 // Present only for array (repeated) types. 2054 type CustomizedImageStatus_FieldPathArrayItemValue interface { 2055 gotenobject.FieldPathArrayItemValue 2056 CustomizedImageStatus_FieldPath 2057 ContainsValue(*CustomizedImage_Status) bool 2058 } 2059 2060 // ParseCustomizedImageStatus_FieldPathArrayItemValue parses string and JSON-encoded value to its Value 2061 func ParseCustomizedImageStatus_FieldPathArrayItemValue(pathStr, valueStr string) (CustomizedImageStatus_FieldPathArrayItemValue, error) { 2062 fp, err := ParseCustomizedImageStatus_FieldPath(pathStr) 2063 if err != nil { 2064 return nil, err 2065 } 2066 fpaiv, err := gotenobject.ParseFieldPathArrayItemValue(fp, valueStr) 2067 if err != nil { 2068 return nil, status.Errorf(codes.InvalidArgument, "error parsing Status field path array item value from %s: %v", valueStr, err) 2069 } 2070 return fpaiv.(CustomizedImageStatus_FieldPathArrayItemValue), nil 2071 } 2072 2073 func MustParseCustomizedImageStatus_FieldPathArrayItemValue(pathStr, valueStr string) CustomizedImageStatus_FieldPathArrayItemValue { 2074 fpaiv, err := ParseCustomizedImageStatus_FieldPathArrayItemValue(pathStr, valueStr) 2075 if err != nil { 2076 panic(err) 2077 } 2078 return fpaiv 2079 } 2080 2081 type CustomizedImageStatus_FieldTerminalPathArrayItemValue struct { 2082 CustomizedImageStatus_FieldTerminalPath 2083 value interface{} 2084 } 2085 2086 var _ CustomizedImageStatus_FieldPathArrayItemValue = (*CustomizedImageStatus_FieldTerminalPathArrayItemValue)(nil) 2087 2088 // GetRawValue returns stored element value for array in object CustomizedImage_Status as interface{} 2089 func (fpaiv *CustomizedImageStatus_FieldTerminalPathArrayItemValue) GetRawItemValue() interface{} { 2090 return fpaiv.value 2091 } 2092 2093 func (fpaiv *CustomizedImageStatus_FieldTerminalPathArrayItemValue) GetSingle(source *CustomizedImage_Status) (interface{}, bool) { 2094 return nil, false 2095 } 2096 2097 func (fpaiv *CustomizedImageStatus_FieldTerminalPathArrayItemValue) GetSingleRaw(source proto.Message) (interface{}, bool) { 2098 return fpaiv.GetSingle(source.(*CustomizedImage_Status)) 2099 } 2100 2101 // Contains returns a boolean indicating if value that is being held is present in given 'Status' 2102 func (fpaiv *CustomizedImageStatus_FieldTerminalPathArrayItemValue) ContainsValue(source *CustomizedImage_Status) bool { 2103 slice := fpaiv.CustomizedImageStatus_FieldTerminalPath.Get(source) 2104 for _, v := range slice { 2105 if asProtoMsg, ok := fpaiv.value.(proto.Message); ok { 2106 if proto.Equal(asProtoMsg, v.(proto.Message)) { 2107 return true 2108 } 2109 } else if reflect.DeepEqual(v, fpaiv.value) { 2110 return true 2111 } 2112 } 2113 return false 2114 } 2115 2116 // CustomizedImageStatus_FieldPathArrayOfValues allows storing slice of values for Status fields according to their type 2117 type CustomizedImageStatus_FieldPathArrayOfValues interface { 2118 gotenobject.FieldPathArrayOfValues 2119 CustomizedImageStatus_FieldPath 2120 } 2121 2122 func ParseCustomizedImageStatus_FieldPathArrayOfValues(pathStr, valuesStr string) (CustomizedImageStatus_FieldPathArrayOfValues, error) { 2123 fp, err := ParseCustomizedImageStatus_FieldPath(pathStr) 2124 if err != nil { 2125 return nil, err 2126 } 2127 fpaov, err := gotenobject.ParseFieldPathArrayOfValues(fp, valuesStr) 2128 if err != nil { 2129 return nil, status.Errorf(codes.InvalidArgument, "error parsing Status field path array of values from %s: %v", valuesStr, err) 2130 } 2131 return fpaov.(CustomizedImageStatus_FieldPathArrayOfValues), nil 2132 } 2133 2134 func MustParseCustomizedImageStatus_FieldPathArrayOfValues(pathStr, valuesStr string) CustomizedImageStatus_FieldPathArrayOfValues { 2135 fpaov, err := ParseCustomizedImageStatus_FieldPathArrayOfValues(pathStr, valuesStr) 2136 if err != nil { 2137 panic(err) 2138 } 2139 return fpaov 2140 } 2141 2142 type CustomizedImageStatus_FieldTerminalPathArrayOfValues struct { 2143 CustomizedImageStatus_FieldTerminalPath 2144 values interface{} 2145 } 2146 2147 var _ CustomizedImageStatus_FieldPathArrayOfValues = (*CustomizedImageStatus_FieldTerminalPathArrayOfValues)(nil) 2148 2149 func (fpaov *CustomizedImageStatus_FieldTerminalPathArrayOfValues) GetRawValues() (values []interface{}) { 2150 switch fpaov.selector { 2151 case CustomizedImageStatus_FieldPathSelectorState: 2152 for _, v := range fpaov.values.([]CustomizedImage_Status_State) { 2153 values = append(values, v) 2154 } 2155 case CustomizedImageStatus_FieldPathSelectorLog: 2156 for _, v := range fpaov.values.([]string) { 2157 values = append(values, v) 2158 } 2159 case CustomizedImageStatus_FieldPathSelectorFile: 2160 for _, v := range fpaov.values.([]string) { 2161 values = append(values, v) 2162 } 2163 } 2164 return 2165 } 2166 func (fpaov *CustomizedImageStatus_FieldTerminalPathArrayOfValues) AsStateArrayOfValues() ([]CustomizedImage_Status_State, bool) { 2167 res, ok := fpaov.values.([]CustomizedImage_Status_State) 2168 return res, ok 2169 } 2170 func (fpaov *CustomizedImageStatus_FieldTerminalPathArrayOfValues) AsLogArrayOfValues() ([]string, bool) { 2171 res, ok := fpaov.values.([]string) 2172 return res, ok 2173 } 2174 func (fpaov *CustomizedImageStatus_FieldTerminalPathArrayOfValues) AsFileArrayOfValues() ([]string, bool) { 2175 res, ok := fpaov.values.([]string) 2176 return res, ok 2177 }