github.com/digitalocean/go-netbox@v0.0.2/netbox/models/virtual_machine_with_config_context.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright 2020 The go-netbox Authors. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 // 17 18 package models 19 20 // This file was generated by the swagger tool. 21 // Editing this file might prove futile when you re-run the swagger generate command 22 23 import ( 24 "context" 25 "encoding/json" 26 "strconv" 27 28 "github.com/go-openapi/errors" 29 "github.com/go-openapi/strfmt" 30 "github.com/go-openapi/swag" 31 "github.com/go-openapi/validate" 32 ) 33 34 // VirtualMachineWithConfigContext virtual machine with config context 35 // 36 // swagger:model VirtualMachineWithConfigContext 37 type VirtualMachineWithConfigContext struct { 38 39 // cluster 40 // Required: true 41 Cluster *NestedCluster `json:"cluster"` 42 43 // Comments 44 Comments string `json:"comments,omitempty"` 45 46 // Config context 47 // Read Only: true 48 ConfigContext map[string]*string `json:"config_context,omitempty"` 49 50 // Created 51 // Read Only: true 52 // Format: date 53 Created strfmt.Date `json:"created,omitempty"` 54 55 // Custom fields 56 CustomFields interface{} `json:"custom_fields,omitempty"` 57 58 // Disk (GB) 59 // Maximum: 2.147483647e+09 60 // Minimum: 0 61 Disk *int64 `json:"disk,omitempty"` 62 63 // Display 64 // Read Only: true 65 Display string `json:"display,omitempty"` 66 67 // Id 68 // Read Only: true 69 ID int64 `json:"id,omitempty"` 70 71 // Last updated 72 // Read Only: true 73 // Format: date-time 74 LastUpdated strfmt.DateTime `json:"last_updated,omitempty"` 75 76 // Local context data 77 LocalContextData *string `json:"local_context_data,omitempty"` 78 79 // Memory (MB) 80 // Maximum: 2.147483647e+09 81 // Minimum: 0 82 Memory *int64 `json:"memory,omitempty"` 83 84 // Name 85 // Required: true 86 // Max Length: 64 87 // Min Length: 1 88 Name *string `json:"name"` 89 90 // platform 91 Platform *NestedPlatform `json:"platform,omitempty"` 92 93 // primary ip 94 PrimaryIP *NestedIPAddress `json:"primary_ip,omitempty"` 95 96 // primary ip4 97 PrimaryIp4 *NestedIPAddress `json:"primary_ip4,omitempty"` 98 99 // primary ip6 100 PrimaryIp6 *NestedIPAddress `json:"primary_ip6,omitempty"` 101 102 // role 103 Role *NestedDeviceRole `json:"role,omitempty"` 104 105 // site 106 Site *NestedSite `json:"site,omitempty"` 107 108 // status 109 Status *VirtualMachineWithConfigContextStatus `json:"status,omitempty"` 110 111 // tags 112 Tags []*NestedTag `json:"tags"` 113 114 // tenant 115 Tenant *NestedTenant `json:"tenant,omitempty"` 116 117 // Url 118 // Read Only: true 119 // Format: uri 120 URL strfmt.URI `json:"url,omitempty"` 121 122 // VCPUs 123 Vcpus *string `json:"vcpus,omitempty"` 124 } 125 126 // Validate validates this virtual machine with config context 127 func (m *VirtualMachineWithConfigContext) Validate(formats strfmt.Registry) error { 128 var res []error 129 130 if err := m.validateCluster(formats); err != nil { 131 res = append(res, err) 132 } 133 134 if err := m.validateCreated(formats); err != nil { 135 res = append(res, err) 136 } 137 138 if err := m.validateDisk(formats); err != nil { 139 res = append(res, err) 140 } 141 142 if err := m.validateLastUpdated(formats); err != nil { 143 res = append(res, err) 144 } 145 146 if err := m.validateMemory(formats); err != nil { 147 res = append(res, err) 148 } 149 150 if err := m.validateName(formats); err != nil { 151 res = append(res, err) 152 } 153 154 if err := m.validatePlatform(formats); err != nil { 155 res = append(res, err) 156 } 157 158 if err := m.validatePrimaryIP(formats); err != nil { 159 res = append(res, err) 160 } 161 162 if err := m.validatePrimaryIp4(formats); err != nil { 163 res = append(res, err) 164 } 165 166 if err := m.validatePrimaryIp6(formats); err != nil { 167 res = append(res, err) 168 } 169 170 if err := m.validateRole(formats); err != nil { 171 res = append(res, err) 172 } 173 174 if err := m.validateSite(formats); err != nil { 175 res = append(res, err) 176 } 177 178 if err := m.validateStatus(formats); err != nil { 179 res = append(res, err) 180 } 181 182 if err := m.validateTags(formats); err != nil { 183 res = append(res, err) 184 } 185 186 if err := m.validateTenant(formats); err != nil { 187 res = append(res, err) 188 } 189 190 if err := m.validateURL(formats); err != nil { 191 res = append(res, err) 192 } 193 194 if len(res) > 0 { 195 return errors.CompositeValidationError(res...) 196 } 197 return nil 198 } 199 200 func (m *VirtualMachineWithConfigContext) validateCluster(formats strfmt.Registry) error { 201 202 if err := validate.Required("cluster", "body", m.Cluster); err != nil { 203 return err 204 } 205 206 if m.Cluster != nil { 207 if err := m.Cluster.Validate(formats); err != nil { 208 if ve, ok := err.(*errors.Validation); ok { 209 return ve.ValidateName("cluster") 210 } else if ce, ok := err.(*errors.CompositeError); ok { 211 return ce.ValidateName("cluster") 212 } 213 return err 214 } 215 } 216 217 return nil 218 } 219 220 func (m *VirtualMachineWithConfigContext) validateCreated(formats strfmt.Registry) error { 221 if swag.IsZero(m.Created) { // not required 222 return nil 223 } 224 225 if err := validate.FormatOf("created", "body", "date", m.Created.String(), formats); err != nil { 226 return err 227 } 228 229 return nil 230 } 231 232 func (m *VirtualMachineWithConfigContext) validateDisk(formats strfmt.Registry) error { 233 if swag.IsZero(m.Disk) { // not required 234 return nil 235 } 236 237 if err := validate.MinimumInt("disk", "body", *m.Disk, 0, false); err != nil { 238 return err 239 } 240 241 if err := validate.MaximumInt("disk", "body", *m.Disk, 2.147483647e+09, false); err != nil { 242 return err 243 } 244 245 return nil 246 } 247 248 func (m *VirtualMachineWithConfigContext) validateLastUpdated(formats strfmt.Registry) error { 249 if swag.IsZero(m.LastUpdated) { // not required 250 return nil 251 } 252 253 if err := validate.FormatOf("last_updated", "body", "date-time", m.LastUpdated.String(), formats); err != nil { 254 return err 255 } 256 257 return nil 258 } 259 260 func (m *VirtualMachineWithConfigContext) validateMemory(formats strfmt.Registry) error { 261 if swag.IsZero(m.Memory) { // not required 262 return nil 263 } 264 265 if err := validate.MinimumInt("memory", "body", *m.Memory, 0, false); err != nil { 266 return err 267 } 268 269 if err := validate.MaximumInt("memory", "body", *m.Memory, 2.147483647e+09, false); err != nil { 270 return err 271 } 272 273 return nil 274 } 275 276 func (m *VirtualMachineWithConfigContext) validateName(formats strfmt.Registry) error { 277 278 if err := validate.Required("name", "body", m.Name); err != nil { 279 return err 280 } 281 282 if err := validate.MinLength("name", "body", *m.Name, 1); err != nil { 283 return err 284 } 285 286 if err := validate.MaxLength("name", "body", *m.Name, 64); err != nil { 287 return err 288 } 289 290 return nil 291 } 292 293 func (m *VirtualMachineWithConfigContext) validatePlatform(formats strfmt.Registry) error { 294 if swag.IsZero(m.Platform) { // not required 295 return nil 296 } 297 298 if m.Platform != nil { 299 if err := m.Platform.Validate(formats); err != nil { 300 if ve, ok := err.(*errors.Validation); ok { 301 return ve.ValidateName("platform") 302 } else if ce, ok := err.(*errors.CompositeError); ok { 303 return ce.ValidateName("platform") 304 } 305 return err 306 } 307 } 308 309 return nil 310 } 311 312 func (m *VirtualMachineWithConfigContext) validatePrimaryIP(formats strfmt.Registry) error { 313 if swag.IsZero(m.PrimaryIP) { // not required 314 return nil 315 } 316 317 if m.PrimaryIP != nil { 318 if err := m.PrimaryIP.Validate(formats); err != nil { 319 if ve, ok := err.(*errors.Validation); ok { 320 return ve.ValidateName("primary_ip") 321 } else if ce, ok := err.(*errors.CompositeError); ok { 322 return ce.ValidateName("primary_ip") 323 } 324 return err 325 } 326 } 327 328 return nil 329 } 330 331 func (m *VirtualMachineWithConfigContext) validatePrimaryIp4(formats strfmt.Registry) error { 332 if swag.IsZero(m.PrimaryIp4) { // not required 333 return nil 334 } 335 336 if m.PrimaryIp4 != nil { 337 if err := m.PrimaryIp4.Validate(formats); err != nil { 338 if ve, ok := err.(*errors.Validation); ok { 339 return ve.ValidateName("primary_ip4") 340 } else if ce, ok := err.(*errors.CompositeError); ok { 341 return ce.ValidateName("primary_ip4") 342 } 343 return err 344 } 345 } 346 347 return nil 348 } 349 350 func (m *VirtualMachineWithConfigContext) validatePrimaryIp6(formats strfmt.Registry) error { 351 if swag.IsZero(m.PrimaryIp6) { // not required 352 return nil 353 } 354 355 if m.PrimaryIp6 != nil { 356 if err := m.PrimaryIp6.Validate(formats); err != nil { 357 if ve, ok := err.(*errors.Validation); ok { 358 return ve.ValidateName("primary_ip6") 359 } else if ce, ok := err.(*errors.CompositeError); ok { 360 return ce.ValidateName("primary_ip6") 361 } 362 return err 363 } 364 } 365 366 return nil 367 } 368 369 func (m *VirtualMachineWithConfigContext) validateRole(formats strfmt.Registry) error { 370 if swag.IsZero(m.Role) { // not required 371 return nil 372 } 373 374 if m.Role != nil { 375 if err := m.Role.Validate(formats); err != nil { 376 if ve, ok := err.(*errors.Validation); ok { 377 return ve.ValidateName("role") 378 } else if ce, ok := err.(*errors.CompositeError); ok { 379 return ce.ValidateName("role") 380 } 381 return err 382 } 383 } 384 385 return nil 386 } 387 388 func (m *VirtualMachineWithConfigContext) validateSite(formats strfmt.Registry) error { 389 if swag.IsZero(m.Site) { // not required 390 return nil 391 } 392 393 if m.Site != nil { 394 if err := m.Site.Validate(formats); err != nil { 395 if ve, ok := err.(*errors.Validation); ok { 396 return ve.ValidateName("site") 397 } else if ce, ok := err.(*errors.CompositeError); ok { 398 return ce.ValidateName("site") 399 } 400 return err 401 } 402 } 403 404 return nil 405 } 406 407 func (m *VirtualMachineWithConfigContext) validateStatus(formats strfmt.Registry) error { 408 if swag.IsZero(m.Status) { // not required 409 return nil 410 } 411 412 if m.Status != nil { 413 if err := m.Status.Validate(formats); err != nil { 414 if ve, ok := err.(*errors.Validation); ok { 415 return ve.ValidateName("status") 416 } else if ce, ok := err.(*errors.CompositeError); ok { 417 return ce.ValidateName("status") 418 } 419 return err 420 } 421 } 422 423 return nil 424 } 425 426 func (m *VirtualMachineWithConfigContext) validateTags(formats strfmt.Registry) error { 427 if swag.IsZero(m.Tags) { // not required 428 return nil 429 } 430 431 for i := 0; i < len(m.Tags); i++ { 432 if swag.IsZero(m.Tags[i]) { // not required 433 continue 434 } 435 436 if m.Tags[i] != nil { 437 if err := m.Tags[i].Validate(formats); err != nil { 438 if ve, ok := err.(*errors.Validation); ok { 439 return ve.ValidateName("tags" + "." + strconv.Itoa(i)) 440 } else if ce, ok := err.(*errors.CompositeError); ok { 441 return ce.ValidateName("tags" + "." + strconv.Itoa(i)) 442 } 443 return err 444 } 445 } 446 447 } 448 449 return nil 450 } 451 452 func (m *VirtualMachineWithConfigContext) validateTenant(formats strfmt.Registry) error { 453 if swag.IsZero(m.Tenant) { // not required 454 return nil 455 } 456 457 if m.Tenant != nil { 458 if err := m.Tenant.Validate(formats); err != nil { 459 if ve, ok := err.(*errors.Validation); ok { 460 return ve.ValidateName("tenant") 461 } else if ce, ok := err.(*errors.CompositeError); ok { 462 return ce.ValidateName("tenant") 463 } 464 return err 465 } 466 } 467 468 return nil 469 } 470 471 func (m *VirtualMachineWithConfigContext) validateURL(formats strfmt.Registry) error { 472 if swag.IsZero(m.URL) { // not required 473 return nil 474 } 475 476 if err := validate.FormatOf("url", "body", "uri", m.URL.String(), formats); err != nil { 477 return err 478 } 479 480 return nil 481 } 482 483 // ContextValidate validate this virtual machine with config context based on the context it is used 484 func (m *VirtualMachineWithConfigContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 485 var res []error 486 487 if err := m.contextValidateCluster(ctx, formats); err != nil { 488 res = append(res, err) 489 } 490 491 if err := m.contextValidateConfigContext(ctx, formats); err != nil { 492 res = append(res, err) 493 } 494 495 if err := m.contextValidateCreated(ctx, formats); err != nil { 496 res = append(res, err) 497 } 498 499 if err := m.contextValidateDisplay(ctx, formats); err != nil { 500 res = append(res, err) 501 } 502 503 if err := m.contextValidateID(ctx, formats); err != nil { 504 res = append(res, err) 505 } 506 507 if err := m.contextValidateLastUpdated(ctx, formats); err != nil { 508 res = append(res, err) 509 } 510 511 if err := m.contextValidatePlatform(ctx, formats); err != nil { 512 res = append(res, err) 513 } 514 515 if err := m.contextValidatePrimaryIP(ctx, formats); err != nil { 516 res = append(res, err) 517 } 518 519 if err := m.contextValidatePrimaryIp4(ctx, formats); err != nil { 520 res = append(res, err) 521 } 522 523 if err := m.contextValidatePrimaryIp6(ctx, formats); err != nil { 524 res = append(res, err) 525 } 526 527 if err := m.contextValidateRole(ctx, formats); err != nil { 528 res = append(res, err) 529 } 530 531 if err := m.contextValidateSite(ctx, formats); err != nil { 532 res = append(res, err) 533 } 534 535 if err := m.contextValidateStatus(ctx, formats); err != nil { 536 res = append(res, err) 537 } 538 539 if err := m.contextValidateTags(ctx, formats); err != nil { 540 res = append(res, err) 541 } 542 543 if err := m.contextValidateTenant(ctx, formats); err != nil { 544 res = append(res, err) 545 } 546 547 if err := m.contextValidateURL(ctx, formats); err != nil { 548 res = append(res, err) 549 } 550 551 if len(res) > 0 { 552 return errors.CompositeValidationError(res...) 553 } 554 return nil 555 } 556 557 func (m *VirtualMachineWithConfigContext) contextValidateCluster(ctx context.Context, formats strfmt.Registry) error { 558 559 if m.Cluster != nil { 560 if err := m.Cluster.ContextValidate(ctx, formats); err != nil { 561 if ve, ok := err.(*errors.Validation); ok { 562 return ve.ValidateName("cluster") 563 } else if ce, ok := err.(*errors.CompositeError); ok { 564 return ce.ValidateName("cluster") 565 } 566 return err 567 } 568 } 569 570 return nil 571 } 572 573 func (m *VirtualMachineWithConfigContext) contextValidateConfigContext(ctx context.Context, formats strfmt.Registry) error { 574 575 return nil 576 } 577 578 func (m *VirtualMachineWithConfigContext) contextValidateCreated(ctx context.Context, formats strfmt.Registry) error { 579 580 if err := validate.ReadOnly(ctx, "created", "body", strfmt.Date(m.Created)); err != nil { 581 return err 582 } 583 584 return nil 585 } 586 587 func (m *VirtualMachineWithConfigContext) contextValidateDisplay(ctx context.Context, formats strfmt.Registry) error { 588 589 if err := validate.ReadOnly(ctx, "display", "body", string(m.Display)); err != nil { 590 return err 591 } 592 593 return nil 594 } 595 596 func (m *VirtualMachineWithConfigContext) contextValidateID(ctx context.Context, formats strfmt.Registry) error { 597 598 if err := validate.ReadOnly(ctx, "id", "body", int64(m.ID)); err != nil { 599 return err 600 } 601 602 return nil 603 } 604 605 func (m *VirtualMachineWithConfigContext) contextValidateLastUpdated(ctx context.Context, formats strfmt.Registry) error { 606 607 if err := validate.ReadOnly(ctx, "last_updated", "body", strfmt.DateTime(m.LastUpdated)); err != nil { 608 return err 609 } 610 611 return nil 612 } 613 614 func (m *VirtualMachineWithConfigContext) contextValidatePlatform(ctx context.Context, formats strfmt.Registry) error { 615 616 if m.Platform != nil { 617 if err := m.Platform.ContextValidate(ctx, formats); err != nil { 618 if ve, ok := err.(*errors.Validation); ok { 619 return ve.ValidateName("platform") 620 } else if ce, ok := err.(*errors.CompositeError); ok { 621 return ce.ValidateName("platform") 622 } 623 return err 624 } 625 } 626 627 return nil 628 } 629 630 func (m *VirtualMachineWithConfigContext) contextValidatePrimaryIP(ctx context.Context, formats strfmt.Registry) error { 631 632 if m.PrimaryIP != nil { 633 if err := m.PrimaryIP.ContextValidate(ctx, formats); err != nil { 634 if ve, ok := err.(*errors.Validation); ok { 635 return ve.ValidateName("primary_ip") 636 } else if ce, ok := err.(*errors.CompositeError); ok { 637 return ce.ValidateName("primary_ip") 638 } 639 return err 640 } 641 } 642 643 return nil 644 } 645 646 func (m *VirtualMachineWithConfigContext) contextValidatePrimaryIp4(ctx context.Context, formats strfmt.Registry) error { 647 648 if m.PrimaryIp4 != nil { 649 if err := m.PrimaryIp4.ContextValidate(ctx, formats); err != nil { 650 if ve, ok := err.(*errors.Validation); ok { 651 return ve.ValidateName("primary_ip4") 652 } else if ce, ok := err.(*errors.CompositeError); ok { 653 return ce.ValidateName("primary_ip4") 654 } 655 return err 656 } 657 } 658 659 return nil 660 } 661 662 func (m *VirtualMachineWithConfigContext) contextValidatePrimaryIp6(ctx context.Context, formats strfmt.Registry) error { 663 664 if m.PrimaryIp6 != nil { 665 if err := m.PrimaryIp6.ContextValidate(ctx, formats); err != nil { 666 if ve, ok := err.(*errors.Validation); ok { 667 return ve.ValidateName("primary_ip6") 668 } else if ce, ok := err.(*errors.CompositeError); ok { 669 return ce.ValidateName("primary_ip6") 670 } 671 return err 672 } 673 } 674 675 return nil 676 } 677 678 func (m *VirtualMachineWithConfigContext) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { 679 680 if m.Role != nil { 681 if err := m.Role.ContextValidate(ctx, formats); err != nil { 682 if ve, ok := err.(*errors.Validation); ok { 683 return ve.ValidateName("role") 684 } else if ce, ok := err.(*errors.CompositeError); ok { 685 return ce.ValidateName("role") 686 } 687 return err 688 } 689 } 690 691 return nil 692 } 693 694 func (m *VirtualMachineWithConfigContext) contextValidateSite(ctx context.Context, formats strfmt.Registry) error { 695 696 if m.Site != nil { 697 if err := m.Site.ContextValidate(ctx, formats); err != nil { 698 if ve, ok := err.(*errors.Validation); ok { 699 return ve.ValidateName("site") 700 } else if ce, ok := err.(*errors.CompositeError); ok { 701 return ce.ValidateName("site") 702 } 703 return err 704 } 705 } 706 707 return nil 708 } 709 710 func (m *VirtualMachineWithConfigContext) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { 711 712 if m.Status != nil { 713 if err := m.Status.ContextValidate(ctx, formats); err != nil { 714 if ve, ok := err.(*errors.Validation); ok { 715 return ve.ValidateName("status") 716 } else if ce, ok := err.(*errors.CompositeError); ok { 717 return ce.ValidateName("status") 718 } 719 return err 720 } 721 } 722 723 return nil 724 } 725 726 func (m *VirtualMachineWithConfigContext) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { 727 728 for i := 0; i < len(m.Tags); i++ { 729 730 if m.Tags[i] != nil { 731 if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { 732 if ve, ok := err.(*errors.Validation); ok { 733 return ve.ValidateName("tags" + "." + strconv.Itoa(i)) 734 } else if ce, ok := err.(*errors.CompositeError); ok { 735 return ce.ValidateName("tags" + "." + strconv.Itoa(i)) 736 } 737 return err 738 } 739 } 740 741 } 742 743 return nil 744 } 745 746 func (m *VirtualMachineWithConfigContext) contextValidateTenant(ctx context.Context, formats strfmt.Registry) error { 747 748 if m.Tenant != nil { 749 if err := m.Tenant.ContextValidate(ctx, formats); err != nil { 750 if ve, ok := err.(*errors.Validation); ok { 751 return ve.ValidateName("tenant") 752 } else if ce, ok := err.(*errors.CompositeError); ok { 753 return ce.ValidateName("tenant") 754 } 755 return err 756 } 757 } 758 759 return nil 760 } 761 762 func (m *VirtualMachineWithConfigContext) contextValidateURL(ctx context.Context, formats strfmt.Registry) error { 763 764 if err := validate.ReadOnly(ctx, "url", "body", strfmt.URI(m.URL)); err != nil { 765 return err 766 } 767 768 return nil 769 } 770 771 // MarshalBinary interface implementation 772 func (m *VirtualMachineWithConfigContext) MarshalBinary() ([]byte, error) { 773 if m == nil { 774 return nil, nil 775 } 776 return swag.WriteJSON(m) 777 } 778 779 // UnmarshalBinary interface implementation 780 func (m *VirtualMachineWithConfigContext) UnmarshalBinary(b []byte) error { 781 var res VirtualMachineWithConfigContext 782 if err := swag.ReadJSON(b, &res); err != nil { 783 return err 784 } 785 *m = res 786 return nil 787 } 788 789 // VirtualMachineWithConfigContextStatus Status 790 // 791 // swagger:model VirtualMachineWithConfigContextStatus 792 type VirtualMachineWithConfigContextStatus struct { 793 794 // label 795 // Required: true 796 // Enum: [Offline Active Planned Staged Failed Decommissioning] 797 Label *string `json:"label"` 798 799 // value 800 // Required: true 801 // Enum: [offline active planned staged failed decommissioning] 802 Value *string `json:"value"` 803 } 804 805 // Validate validates this virtual machine with config context status 806 func (m *VirtualMachineWithConfigContextStatus) Validate(formats strfmt.Registry) error { 807 var res []error 808 809 if err := m.validateLabel(formats); err != nil { 810 res = append(res, err) 811 } 812 813 if err := m.validateValue(formats); err != nil { 814 res = append(res, err) 815 } 816 817 if len(res) > 0 { 818 return errors.CompositeValidationError(res...) 819 } 820 return nil 821 } 822 823 var virtualMachineWithConfigContextStatusTypeLabelPropEnum []interface{} 824 825 func init() { 826 var res []string 827 if err := json.Unmarshal([]byte(`["Offline","Active","Planned","Staged","Failed","Decommissioning"]`), &res); err != nil { 828 panic(err) 829 } 830 for _, v := range res { 831 virtualMachineWithConfigContextStatusTypeLabelPropEnum = append(virtualMachineWithConfigContextStatusTypeLabelPropEnum, v) 832 } 833 } 834 835 const ( 836 837 // VirtualMachineWithConfigContextStatusLabelOffline captures enum value "Offline" 838 VirtualMachineWithConfigContextStatusLabelOffline string = "Offline" 839 840 // VirtualMachineWithConfigContextStatusLabelActive captures enum value "Active" 841 VirtualMachineWithConfigContextStatusLabelActive string = "Active" 842 843 // VirtualMachineWithConfigContextStatusLabelPlanned captures enum value "Planned" 844 VirtualMachineWithConfigContextStatusLabelPlanned string = "Planned" 845 846 // VirtualMachineWithConfigContextStatusLabelStaged captures enum value "Staged" 847 VirtualMachineWithConfigContextStatusLabelStaged string = "Staged" 848 849 // VirtualMachineWithConfigContextStatusLabelFailed captures enum value "Failed" 850 VirtualMachineWithConfigContextStatusLabelFailed string = "Failed" 851 852 // VirtualMachineWithConfigContextStatusLabelDecommissioning captures enum value "Decommissioning" 853 VirtualMachineWithConfigContextStatusLabelDecommissioning string = "Decommissioning" 854 ) 855 856 // prop value enum 857 func (m *VirtualMachineWithConfigContextStatus) validateLabelEnum(path, location string, value string) error { 858 if err := validate.EnumCase(path, location, value, virtualMachineWithConfigContextStatusTypeLabelPropEnum, true); err != nil { 859 return err 860 } 861 return nil 862 } 863 864 func (m *VirtualMachineWithConfigContextStatus) validateLabel(formats strfmt.Registry) error { 865 866 if err := validate.Required("status"+"."+"label", "body", m.Label); err != nil { 867 return err 868 } 869 870 // value enum 871 if err := m.validateLabelEnum("status"+"."+"label", "body", *m.Label); err != nil { 872 return err 873 } 874 875 return nil 876 } 877 878 var virtualMachineWithConfigContextStatusTypeValuePropEnum []interface{} 879 880 func init() { 881 var res []string 882 if err := json.Unmarshal([]byte(`["offline","active","planned","staged","failed","decommissioning"]`), &res); err != nil { 883 panic(err) 884 } 885 for _, v := range res { 886 virtualMachineWithConfigContextStatusTypeValuePropEnum = append(virtualMachineWithConfigContextStatusTypeValuePropEnum, v) 887 } 888 } 889 890 const ( 891 892 // VirtualMachineWithConfigContextStatusValueOffline captures enum value "offline" 893 VirtualMachineWithConfigContextStatusValueOffline string = "offline" 894 895 // VirtualMachineWithConfigContextStatusValueActive captures enum value "active" 896 VirtualMachineWithConfigContextStatusValueActive string = "active" 897 898 // VirtualMachineWithConfigContextStatusValuePlanned captures enum value "planned" 899 VirtualMachineWithConfigContextStatusValuePlanned string = "planned" 900 901 // VirtualMachineWithConfigContextStatusValueStaged captures enum value "staged" 902 VirtualMachineWithConfigContextStatusValueStaged string = "staged" 903 904 // VirtualMachineWithConfigContextStatusValueFailed captures enum value "failed" 905 VirtualMachineWithConfigContextStatusValueFailed string = "failed" 906 907 // VirtualMachineWithConfigContextStatusValueDecommissioning captures enum value "decommissioning" 908 VirtualMachineWithConfigContextStatusValueDecommissioning string = "decommissioning" 909 ) 910 911 // prop value enum 912 func (m *VirtualMachineWithConfigContextStatus) validateValueEnum(path, location string, value string) error { 913 if err := validate.EnumCase(path, location, value, virtualMachineWithConfigContextStatusTypeValuePropEnum, true); err != nil { 914 return err 915 } 916 return nil 917 } 918 919 func (m *VirtualMachineWithConfigContextStatus) validateValue(formats strfmt.Registry) error { 920 921 if err := validate.Required("status"+"."+"value", "body", m.Value); err != nil { 922 return err 923 } 924 925 // value enum 926 if err := m.validateValueEnum("status"+"."+"value", "body", *m.Value); err != nil { 927 return err 928 } 929 930 return nil 931 } 932 933 // ContextValidate validates this virtual machine with config context status based on context it is used 934 func (m *VirtualMachineWithConfigContextStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 935 return nil 936 } 937 938 // MarshalBinary interface implementation 939 func (m *VirtualMachineWithConfigContextStatus) MarshalBinary() ([]byte, error) { 940 if m == nil { 941 return nil, nil 942 } 943 return swag.WriteJSON(m) 944 } 945 946 // UnmarshalBinary interface implementation 947 func (m *VirtualMachineWithConfigContextStatus) UnmarshalBinary(b []byte) error { 948 var res VirtualMachineWithConfigContextStatus 949 if err := swag.ReadJSON(b, &res); err != nil { 950 return err 951 } 952 *m = res 953 return nil 954 }