github.com/digitalocean/go-netbox@v0.0.2/netbox/models/console_port.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 // ConsolePort console port 35 // 36 // swagger:model ConsolePort 37 type ConsolePort struct { 38 39 // occupied 40 // Read Only: true 41 Occupied *bool `json:"_occupied,omitempty"` 42 43 // cable 44 Cable *NestedCable `json:"cable,omitempty"` 45 46 // Cable peer 47 // 48 // 49 // Return the appropriate serializer for the cable termination model. 50 // 51 // Read Only: true 52 CablePeer map[string]*string `json:"cable_peer,omitempty"` 53 54 // Cable peer type 55 // Read Only: true 56 CablePeerType string `json:"cable_peer_type,omitempty"` 57 58 // Connected endpoint 59 // 60 // 61 // Return the appropriate serializer for the type of connected object. 62 // 63 // Read Only: true 64 ConnectedEndpoint map[string]*string `json:"connected_endpoint,omitempty"` 65 66 // Connected endpoint reachable 67 // Read Only: true 68 ConnectedEndpointReachable *bool `json:"connected_endpoint_reachable,omitempty"` 69 70 // Connected endpoint type 71 // Read Only: true 72 ConnectedEndpointType string `json:"connected_endpoint_type,omitempty"` 73 74 // Created 75 // Read Only: true 76 // Format: date 77 Created strfmt.Date `json:"created,omitempty"` 78 79 // Custom fields 80 CustomFields interface{} `json:"custom_fields,omitempty"` 81 82 // Description 83 // Max Length: 200 84 Description string `json:"description,omitempty"` 85 86 // device 87 // Required: true 88 Device *NestedDevice `json:"device"` 89 90 // Display 91 // Read Only: true 92 Display string `json:"display,omitempty"` 93 94 // Id 95 // Read Only: true 96 ID int64 `json:"id,omitempty"` 97 98 // Label 99 // 100 // Physical label 101 // Max Length: 64 102 Label string `json:"label,omitempty"` 103 104 // Last updated 105 // Read Only: true 106 // Format: date-time 107 LastUpdated strfmt.DateTime `json:"last_updated,omitempty"` 108 109 // Mark connected 110 // 111 // Treat as if a cable is connected 112 MarkConnected bool `json:"mark_connected,omitempty"` 113 114 // Name 115 // Required: true 116 // Max Length: 64 117 // Min Length: 1 118 Name *string `json:"name"` 119 120 // speed 121 Speed *ConsolePortSpeed `json:"speed,omitempty"` 122 123 // tags 124 Tags []*NestedTag `json:"tags"` 125 126 // type 127 Type *ConsolePortType `json:"type,omitempty"` 128 129 // Url 130 // Read Only: true 131 // Format: uri 132 URL strfmt.URI `json:"url,omitempty"` 133 } 134 135 // Validate validates this console port 136 func (m *ConsolePort) Validate(formats strfmt.Registry) error { 137 var res []error 138 139 if err := m.validateCable(formats); err != nil { 140 res = append(res, err) 141 } 142 143 if err := m.validateCreated(formats); err != nil { 144 res = append(res, err) 145 } 146 147 if err := m.validateDescription(formats); err != nil { 148 res = append(res, err) 149 } 150 151 if err := m.validateDevice(formats); err != nil { 152 res = append(res, err) 153 } 154 155 if err := m.validateLabel(formats); err != nil { 156 res = append(res, err) 157 } 158 159 if err := m.validateLastUpdated(formats); err != nil { 160 res = append(res, err) 161 } 162 163 if err := m.validateName(formats); err != nil { 164 res = append(res, err) 165 } 166 167 if err := m.validateSpeed(formats); err != nil { 168 res = append(res, err) 169 } 170 171 if err := m.validateTags(formats); err != nil { 172 res = append(res, err) 173 } 174 175 if err := m.validateType(formats); err != nil { 176 res = append(res, err) 177 } 178 179 if err := m.validateURL(formats); err != nil { 180 res = append(res, err) 181 } 182 183 if len(res) > 0 { 184 return errors.CompositeValidationError(res...) 185 } 186 return nil 187 } 188 189 func (m *ConsolePort) validateCable(formats strfmt.Registry) error { 190 if swag.IsZero(m.Cable) { // not required 191 return nil 192 } 193 194 if m.Cable != nil { 195 if err := m.Cable.Validate(formats); err != nil { 196 if ve, ok := err.(*errors.Validation); ok { 197 return ve.ValidateName("cable") 198 } else if ce, ok := err.(*errors.CompositeError); ok { 199 return ce.ValidateName("cable") 200 } 201 return err 202 } 203 } 204 205 return nil 206 } 207 208 func (m *ConsolePort) validateCreated(formats strfmt.Registry) error { 209 if swag.IsZero(m.Created) { // not required 210 return nil 211 } 212 213 if err := validate.FormatOf("created", "body", "date", m.Created.String(), formats); err != nil { 214 return err 215 } 216 217 return nil 218 } 219 220 func (m *ConsolePort) validateDescription(formats strfmt.Registry) error { 221 if swag.IsZero(m.Description) { // not required 222 return nil 223 } 224 225 if err := validate.MaxLength("description", "body", m.Description, 200); err != nil { 226 return err 227 } 228 229 return nil 230 } 231 232 func (m *ConsolePort) validateDevice(formats strfmt.Registry) error { 233 234 if err := validate.Required("device", "body", m.Device); err != nil { 235 return err 236 } 237 238 if m.Device != nil { 239 if err := m.Device.Validate(formats); err != nil { 240 if ve, ok := err.(*errors.Validation); ok { 241 return ve.ValidateName("device") 242 } else if ce, ok := err.(*errors.CompositeError); ok { 243 return ce.ValidateName("device") 244 } 245 return err 246 } 247 } 248 249 return nil 250 } 251 252 func (m *ConsolePort) validateLabel(formats strfmt.Registry) error { 253 if swag.IsZero(m.Label) { // not required 254 return nil 255 } 256 257 if err := validate.MaxLength("label", "body", m.Label, 64); err != nil { 258 return err 259 } 260 261 return nil 262 } 263 264 func (m *ConsolePort) validateLastUpdated(formats strfmt.Registry) error { 265 if swag.IsZero(m.LastUpdated) { // not required 266 return nil 267 } 268 269 if err := validate.FormatOf("last_updated", "body", "date-time", m.LastUpdated.String(), formats); err != nil { 270 return err 271 } 272 273 return nil 274 } 275 276 func (m *ConsolePort) 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 *ConsolePort) validateSpeed(formats strfmt.Registry) error { 294 if swag.IsZero(m.Speed) { // not required 295 return nil 296 } 297 298 if m.Speed != nil { 299 if err := m.Speed.Validate(formats); err != nil { 300 if ve, ok := err.(*errors.Validation); ok { 301 return ve.ValidateName("speed") 302 } else if ce, ok := err.(*errors.CompositeError); ok { 303 return ce.ValidateName("speed") 304 } 305 return err 306 } 307 } 308 309 return nil 310 } 311 312 func (m *ConsolePort) validateTags(formats strfmt.Registry) error { 313 if swag.IsZero(m.Tags) { // not required 314 return nil 315 } 316 317 for i := 0; i < len(m.Tags); i++ { 318 if swag.IsZero(m.Tags[i]) { // not required 319 continue 320 } 321 322 if m.Tags[i] != nil { 323 if err := m.Tags[i].Validate(formats); err != nil { 324 if ve, ok := err.(*errors.Validation); ok { 325 return ve.ValidateName("tags" + "." + strconv.Itoa(i)) 326 } else if ce, ok := err.(*errors.CompositeError); ok { 327 return ce.ValidateName("tags" + "." + strconv.Itoa(i)) 328 } 329 return err 330 } 331 } 332 333 } 334 335 return nil 336 } 337 338 func (m *ConsolePort) validateType(formats strfmt.Registry) error { 339 if swag.IsZero(m.Type) { // not required 340 return nil 341 } 342 343 if m.Type != nil { 344 if err := m.Type.Validate(formats); err != nil { 345 if ve, ok := err.(*errors.Validation); ok { 346 return ve.ValidateName("type") 347 } else if ce, ok := err.(*errors.CompositeError); ok { 348 return ce.ValidateName("type") 349 } 350 return err 351 } 352 } 353 354 return nil 355 } 356 357 func (m *ConsolePort) validateURL(formats strfmt.Registry) error { 358 if swag.IsZero(m.URL) { // not required 359 return nil 360 } 361 362 if err := validate.FormatOf("url", "body", "uri", m.URL.String(), formats); err != nil { 363 return err 364 } 365 366 return nil 367 } 368 369 // ContextValidate validate this console port based on the context it is used 370 func (m *ConsolePort) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 371 var res []error 372 373 if err := m.contextValidateOccupied(ctx, formats); err != nil { 374 res = append(res, err) 375 } 376 377 if err := m.contextValidateCable(ctx, formats); err != nil { 378 res = append(res, err) 379 } 380 381 if err := m.contextValidateCablePeer(ctx, formats); err != nil { 382 res = append(res, err) 383 } 384 385 if err := m.contextValidateCablePeerType(ctx, formats); err != nil { 386 res = append(res, err) 387 } 388 389 if err := m.contextValidateConnectedEndpoint(ctx, formats); err != nil { 390 res = append(res, err) 391 } 392 393 if err := m.contextValidateConnectedEndpointReachable(ctx, formats); err != nil { 394 res = append(res, err) 395 } 396 397 if err := m.contextValidateConnectedEndpointType(ctx, formats); err != nil { 398 res = append(res, err) 399 } 400 401 if err := m.contextValidateCreated(ctx, formats); err != nil { 402 res = append(res, err) 403 } 404 405 if err := m.contextValidateDevice(ctx, formats); err != nil { 406 res = append(res, err) 407 } 408 409 if err := m.contextValidateDisplay(ctx, formats); err != nil { 410 res = append(res, err) 411 } 412 413 if err := m.contextValidateID(ctx, formats); err != nil { 414 res = append(res, err) 415 } 416 417 if err := m.contextValidateLastUpdated(ctx, formats); err != nil { 418 res = append(res, err) 419 } 420 421 if err := m.contextValidateSpeed(ctx, formats); err != nil { 422 res = append(res, err) 423 } 424 425 if err := m.contextValidateTags(ctx, formats); err != nil { 426 res = append(res, err) 427 } 428 429 if err := m.contextValidateType(ctx, formats); err != nil { 430 res = append(res, err) 431 } 432 433 if err := m.contextValidateURL(ctx, formats); err != nil { 434 res = append(res, err) 435 } 436 437 if len(res) > 0 { 438 return errors.CompositeValidationError(res...) 439 } 440 return nil 441 } 442 443 func (m *ConsolePort) contextValidateOccupied(ctx context.Context, formats strfmt.Registry) error { 444 445 if err := validate.ReadOnly(ctx, "_occupied", "body", m.Occupied); err != nil { 446 return err 447 } 448 449 return nil 450 } 451 452 func (m *ConsolePort) contextValidateCable(ctx context.Context, formats strfmt.Registry) error { 453 454 if m.Cable != nil { 455 if err := m.Cable.ContextValidate(ctx, formats); err != nil { 456 if ve, ok := err.(*errors.Validation); ok { 457 return ve.ValidateName("cable") 458 } else if ce, ok := err.(*errors.CompositeError); ok { 459 return ce.ValidateName("cable") 460 } 461 return err 462 } 463 } 464 465 return nil 466 } 467 468 func (m *ConsolePort) contextValidateCablePeer(ctx context.Context, formats strfmt.Registry) error { 469 470 return nil 471 } 472 473 func (m *ConsolePort) contextValidateCablePeerType(ctx context.Context, formats strfmt.Registry) error { 474 475 if err := validate.ReadOnly(ctx, "cable_peer_type", "body", string(m.CablePeerType)); err != nil { 476 return err 477 } 478 479 return nil 480 } 481 482 func (m *ConsolePort) contextValidateConnectedEndpoint(ctx context.Context, formats strfmt.Registry) error { 483 484 return nil 485 } 486 487 func (m *ConsolePort) contextValidateConnectedEndpointReachable(ctx context.Context, formats strfmt.Registry) error { 488 489 if err := validate.ReadOnly(ctx, "connected_endpoint_reachable", "body", m.ConnectedEndpointReachable); err != nil { 490 return err 491 } 492 493 return nil 494 } 495 496 func (m *ConsolePort) contextValidateConnectedEndpointType(ctx context.Context, formats strfmt.Registry) error { 497 498 if err := validate.ReadOnly(ctx, "connected_endpoint_type", "body", string(m.ConnectedEndpointType)); err != nil { 499 return err 500 } 501 502 return nil 503 } 504 505 func (m *ConsolePort) contextValidateCreated(ctx context.Context, formats strfmt.Registry) error { 506 507 if err := validate.ReadOnly(ctx, "created", "body", strfmt.Date(m.Created)); err != nil { 508 return err 509 } 510 511 return nil 512 } 513 514 func (m *ConsolePort) contextValidateDevice(ctx context.Context, formats strfmt.Registry) error { 515 516 if m.Device != nil { 517 if err := m.Device.ContextValidate(ctx, formats); err != nil { 518 if ve, ok := err.(*errors.Validation); ok { 519 return ve.ValidateName("device") 520 } else if ce, ok := err.(*errors.CompositeError); ok { 521 return ce.ValidateName("device") 522 } 523 return err 524 } 525 } 526 527 return nil 528 } 529 530 func (m *ConsolePort) contextValidateDisplay(ctx context.Context, formats strfmt.Registry) error { 531 532 if err := validate.ReadOnly(ctx, "display", "body", string(m.Display)); err != nil { 533 return err 534 } 535 536 return nil 537 } 538 539 func (m *ConsolePort) contextValidateID(ctx context.Context, formats strfmt.Registry) error { 540 541 if err := validate.ReadOnly(ctx, "id", "body", int64(m.ID)); err != nil { 542 return err 543 } 544 545 return nil 546 } 547 548 func (m *ConsolePort) contextValidateLastUpdated(ctx context.Context, formats strfmt.Registry) error { 549 550 if err := validate.ReadOnly(ctx, "last_updated", "body", strfmt.DateTime(m.LastUpdated)); err != nil { 551 return err 552 } 553 554 return nil 555 } 556 557 func (m *ConsolePort) contextValidateSpeed(ctx context.Context, formats strfmt.Registry) error { 558 559 if m.Speed != nil { 560 if err := m.Speed.ContextValidate(ctx, formats); err != nil { 561 if ve, ok := err.(*errors.Validation); ok { 562 return ve.ValidateName("speed") 563 } else if ce, ok := err.(*errors.CompositeError); ok { 564 return ce.ValidateName("speed") 565 } 566 return err 567 } 568 } 569 570 return nil 571 } 572 573 func (m *ConsolePort) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { 574 575 for i := 0; i < len(m.Tags); i++ { 576 577 if m.Tags[i] != nil { 578 if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { 579 if ve, ok := err.(*errors.Validation); ok { 580 return ve.ValidateName("tags" + "." + strconv.Itoa(i)) 581 } else if ce, ok := err.(*errors.CompositeError); ok { 582 return ce.ValidateName("tags" + "." + strconv.Itoa(i)) 583 } 584 return err 585 } 586 } 587 588 } 589 590 return nil 591 } 592 593 func (m *ConsolePort) contextValidateType(ctx context.Context, formats strfmt.Registry) error { 594 595 if m.Type != nil { 596 if err := m.Type.ContextValidate(ctx, formats); err != nil { 597 if ve, ok := err.(*errors.Validation); ok { 598 return ve.ValidateName("type") 599 } else if ce, ok := err.(*errors.CompositeError); ok { 600 return ce.ValidateName("type") 601 } 602 return err 603 } 604 } 605 606 return nil 607 } 608 609 func (m *ConsolePort) contextValidateURL(ctx context.Context, formats strfmt.Registry) error { 610 611 if err := validate.ReadOnly(ctx, "url", "body", strfmt.URI(m.URL)); err != nil { 612 return err 613 } 614 615 return nil 616 } 617 618 // MarshalBinary interface implementation 619 func (m *ConsolePort) MarshalBinary() ([]byte, error) { 620 if m == nil { 621 return nil, nil 622 } 623 return swag.WriteJSON(m) 624 } 625 626 // UnmarshalBinary interface implementation 627 func (m *ConsolePort) UnmarshalBinary(b []byte) error { 628 var res ConsolePort 629 if err := swag.ReadJSON(b, &res); err != nil { 630 return err 631 } 632 *m = res 633 return nil 634 } 635 636 // ConsolePortSpeed Speed 637 // 638 // swagger:model ConsolePortSpeed 639 type ConsolePortSpeed struct { 640 641 // label 642 // Required: true 643 // Enum: [1200 bps 2400 bps 4800 bps 9600 bps 19.2 kbps 38.4 kbps 57.6 kbps 115.2 kbps] 644 Label *string `json:"label"` 645 646 // value 647 // Required: true 648 // Enum: [1200 2400 4800 9600 19200 38400 57600 115200] 649 Value *int64 `json:"value"` 650 } 651 652 // Validate validates this console port speed 653 func (m *ConsolePortSpeed) Validate(formats strfmt.Registry) error { 654 var res []error 655 656 if err := m.validateLabel(formats); err != nil { 657 res = append(res, err) 658 } 659 660 if err := m.validateValue(formats); err != nil { 661 res = append(res, err) 662 } 663 664 if len(res) > 0 { 665 return errors.CompositeValidationError(res...) 666 } 667 return nil 668 } 669 670 var consolePortSpeedTypeLabelPropEnum []interface{} 671 672 func init() { 673 var res []string 674 if err := json.Unmarshal([]byte(`["1200 bps","2400 bps","4800 bps","9600 bps","19.2 kbps","38.4 kbps","57.6 kbps","115.2 kbps"]`), &res); err != nil { 675 panic(err) 676 } 677 for _, v := range res { 678 consolePortSpeedTypeLabelPropEnum = append(consolePortSpeedTypeLabelPropEnum, v) 679 } 680 } 681 682 const ( 683 684 // ConsolePortSpeedLabelNr1200Bps captures enum value "1200 bps" 685 ConsolePortSpeedLabelNr1200Bps string = "1200 bps" 686 687 // ConsolePortSpeedLabelNr2400Bps captures enum value "2400 bps" 688 ConsolePortSpeedLabelNr2400Bps string = "2400 bps" 689 690 // ConsolePortSpeedLabelNr4800Bps captures enum value "4800 bps" 691 ConsolePortSpeedLabelNr4800Bps string = "4800 bps" 692 693 // ConsolePortSpeedLabelNr9600Bps captures enum value "9600 bps" 694 ConsolePortSpeedLabelNr9600Bps string = "9600 bps" 695 696 // ConsolePortSpeedLabelNr19Dot2Kbps captures enum value "19.2 kbps" 697 ConsolePortSpeedLabelNr19Dot2Kbps string = "19.2 kbps" 698 699 // ConsolePortSpeedLabelNr38Dot4Kbps captures enum value "38.4 kbps" 700 ConsolePortSpeedLabelNr38Dot4Kbps string = "38.4 kbps" 701 702 // ConsolePortSpeedLabelNr57Dot6Kbps captures enum value "57.6 kbps" 703 ConsolePortSpeedLabelNr57Dot6Kbps string = "57.6 kbps" 704 705 // ConsolePortSpeedLabelNr115Dot2Kbps captures enum value "115.2 kbps" 706 ConsolePortSpeedLabelNr115Dot2Kbps string = "115.2 kbps" 707 ) 708 709 // prop value enum 710 func (m *ConsolePortSpeed) validateLabelEnum(path, location string, value string) error { 711 if err := validate.EnumCase(path, location, value, consolePortSpeedTypeLabelPropEnum, true); err != nil { 712 return err 713 } 714 return nil 715 } 716 717 func (m *ConsolePortSpeed) validateLabel(formats strfmt.Registry) error { 718 719 if err := validate.Required("speed"+"."+"label", "body", m.Label); err != nil { 720 return err 721 } 722 723 // value enum 724 if err := m.validateLabelEnum("speed"+"."+"label", "body", *m.Label); err != nil { 725 return err 726 } 727 728 return nil 729 } 730 731 var consolePortSpeedTypeValuePropEnum []interface{} 732 733 func init() { 734 var res []int64 735 if err := json.Unmarshal([]byte(`[1200,2400,4800,9600,19200,38400,57600,115200]`), &res); err != nil { 736 panic(err) 737 } 738 for _, v := range res { 739 consolePortSpeedTypeValuePropEnum = append(consolePortSpeedTypeValuePropEnum, v) 740 } 741 } 742 743 // prop value enum 744 func (m *ConsolePortSpeed) validateValueEnum(path, location string, value int64) error { 745 if err := validate.EnumCase(path, location, value, consolePortSpeedTypeValuePropEnum, true); err != nil { 746 return err 747 } 748 return nil 749 } 750 751 func (m *ConsolePortSpeed) validateValue(formats strfmt.Registry) error { 752 753 if err := validate.Required("speed"+"."+"value", "body", m.Value); err != nil { 754 return err 755 } 756 757 // value enum 758 if err := m.validateValueEnum("speed"+"."+"value", "body", *m.Value); err != nil { 759 return err 760 } 761 762 return nil 763 } 764 765 // ContextValidate validates this console port speed based on context it is used 766 func (m *ConsolePortSpeed) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 767 return nil 768 } 769 770 // MarshalBinary interface implementation 771 func (m *ConsolePortSpeed) MarshalBinary() ([]byte, error) { 772 if m == nil { 773 return nil, nil 774 } 775 return swag.WriteJSON(m) 776 } 777 778 // UnmarshalBinary interface implementation 779 func (m *ConsolePortSpeed) UnmarshalBinary(b []byte) error { 780 var res ConsolePortSpeed 781 if err := swag.ReadJSON(b, &res); err != nil { 782 return err 783 } 784 *m = res 785 return nil 786 } 787 788 // ConsolePortType Type 789 // 790 // swagger:model ConsolePortType 791 type ConsolePortType struct { 792 793 // label 794 // Required: true 795 // Enum: [DE-9 DB-25 RJ-11 RJ-12 RJ-45 USB Type A USB Type B USB Type C USB Mini A USB Mini B USB Micro A USB Micro B Other] 796 Label *string `json:"label"` 797 798 // value 799 // Required: true 800 // Enum: [de-9 db-25 rj-11 rj-12 rj-45 usb-a usb-b usb-c usb-mini-a usb-mini-b usb-micro-a usb-micro-b other] 801 Value *string `json:"value"` 802 } 803 804 // Validate validates this console port type 805 func (m *ConsolePortType) Validate(formats strfmt.Registry) error { 806 var res []error 807 808 if err := m.validateLabel(formats); err != nil { 809 res = append(res, err) 810 } 811 812 if err := m.validateValue(formats); err != nil { 813 res = append(res, err) 814 } 815 816 if len(res) > 0 { 817 return errors.CompositeValidationError(res...) 818 } 819 return nil 820 } 821 822 var consolePortTypeTypeLabelPropEnum []interface{} 823 824 func init() { 825 var res []string 826 if err := json.Unmarshal([]byte(`["DE-9","DB-25","RJ-11","RJ-12","RJ-45","USB Type A","USB Type B","USB Type C","USB Mini A","USB Mini B","USB Micro A","USB Micro B","Other"]`), &res); err != nil { 827 panic(err) 828 } 829 for _, v := range res { 830 consolePortTypeTypeLabelPropEnum = append(consolePortTypeTypeLabelPropEnum, v) 831 } 832 } 833 834 const ( 835 836 // ConsolePortTypeLabelDEDash9 captures enum value "DE-9" 837 ConsolePortTypeLabelDEDash9 string = "DE-9" 838 839 // ConsolePortTypeLabelDBDash25 captures enum value "DB-25" 840 ConsolePortTypeLabelDBDash25 string = "DB-25" 841 842 // ConsolePortTypeLabelRJDash11 captures enum value "RJ-11" 843 ConsolePortTypeLabelRJDash11 string = "RJ-11" 844 845 // ConsolePortTypeLabelRJDash12 captures enum value "RJ-12" 846 ConsolePortTypeLabelRJDash12 string = "RJ-12" 847 848 // ConsolePortTypeLabelRJDash45 captures enum value "RJ-45" 849 ConsolePortTypeLabelRJDash45 string = "RJ-45" 850 851 // ConsolePortTypeLabelUSBTypeA captures enum value "USB Type A" 852 ConsolePortTypeLabelUSBTypeA string = "USB Type A" 853 854 // ConsolePortTypeLabelUSBTypeB captures enum value "USB Type B" 855 ConsolePortTypeLabelUSBTypeB string = "USB Type B" 856 857 // ConsolePortTypeLabelUSBTypeC captures enum value "USB Type C" 858 ConsolePortTypeLabelUSBTypeC string = "USB Type C" 859 860 // ConsolePortTypeLabelUSBMiniA captures enum value "USB Mini A" 861 ConsolePortTypeLabelUSBMiniA string = "USB Mini A" 862 863 // ConsolePortTypeLabelUSBMiniB captures enum value "USB Mini B" 864 ConsolePortTypeLabelUSBMiniB string = "USB Mini B" 865 866 // ConsolePortTypeLabelUSBMicroA captures enum value "USB Micro A" 867 ConsolePortTypeLabelUSBMicroA string = "USB Micro A" 868 869 // ConsolePortTypeLabelUSBMicroB captures enum value "USB Micro B" 870 ConsolePortTypeLabelUSBMicroB string = "USB Micro B" 871 872 // ConsolePortTypeLabelOther captures enum value "Other" 873 ConsolePortTypeLabelOther string = "Other" 874 ) 875 876 // prop value enum 877 func (m *ConsolePortType) validateLabelEnum(path, location string, value string) error { 878 if err := validate.EnumCase(path, location, value, consolePortTypeTypeLabelPropEnum, true); err != nil { 879 return err 880 } 881 return nil 882 } 883 884 func (m *ConsolePortType) validateLabel(formats strfmt.Registry) error { 885 886 if err := validate.Required("type"+"."+"label", "body", m.Label); err != nil { 887 return err 888 } 889 890 // value enum 891 if err := m.validateLabelEnum("type"+"."+"label", "body", *m.Label); err != nil { 892 return err 893 } 894 895 return nil 896 } 897 898 var consolePortTypeTypeValuePropEnum []interface{} 899 900 func init() { 901 var res []string 902 if err := json.Unmarshal([]byte(`["de-9","db-25","rj-11","rj-12","rj-45","usb-a","usb-b","usb-c","usb-mini-a","usb-mini-b","usb-micro-a","usb-micro-b","other"]`), &res); err != nil { 903 panic(err) 904 } 905 for _, v := range res { 906 consolePortTypeTypeValuePropEnum = append(consolePortTypeTypeValuePropEnum, v) 907 } 908 } 909 910 const ( 911 912 // ConsolePortTypeValueDeDash9 captures enum value "de-9" 913 ConsolePortTypeValueDeDash9 string = "de-9" 914 915 // ConsolePortTypeValueDbDash25 captures enum value "db-25" 916 ConsolePortTypeValueDbDash25 string = "db-25" 917 918 // ConsolePortTypeValueRjDash11 captures enum value "rj-11" 919 ConsolePortTypeValueRjDash11 string = "rj-11" 920 921 // ConsolePortTypeValueRjDash12 captures enum value "rj-12" 922 ConsolePortTypeValueRjDash12 string = "rj-12" 923 924 // ConsolePortTypeValueRjDash45 captures enum value "rj-45" 925 ConsolePortTypeValueRjDash45 string = "rj-45" 926 927 // ConsolePortTypeValueUsbDasha captures enum value "usb-a" 928 ConsolePortTypeValueUsbDasha string = "usb-a" 929 930 // ConsolePortTypeValueUsbDashb captures enum value "usb-b" 931 ConsolePortTypeValueUsbDashb string = "usb-b" 932 933 // ConsolePortTypeValueUsbDashc captures enum value "usb-c" 934 ConsolePortTypeValueUsbDashc string = "usb-c" 935 936 // ConsolePortTypeValueUsbDashMiniDasha captures enum value "usb-mini-a" 937 ConsolePortTypeValueUsbDashMiniDasha string = "usb-mini-a" 938 939 // ConsolePortTypeValueUsbDashMiniDashb captures enum value "usb-mini-b" 940 ConsolePortTypeValueUsbDashMiniDashb string = "usb-mini-b" 941 942 // ConsolePortTypeValueUsbDashMicroDasha captures enum value "usb-micro-a" 943 ConsolePortTypeValueUsbDashMicroDasha string = "usb-micro-a" 944 945 // ConsolePortTypeValueUsbDashMicroDashb captures enum value "usb-micro-b" 946 ConsolePortTypeValueUsbDashMicroDashb string = "usb-micro-b" 947 948 // ConsolePortTypeValueOther captures enum value "other" 949 ConsolePortTypeValueOther string = "other" 950 ) 951 952 // prop value enum 953 func (m *ConsolePortType) validateValueEnum(path, location string, value string) error { 954 if err := validate.EnumCase(path, location, value, consolePortTypeTypeValuePropEnum, true); err != nil { 955 return err 956 } 957 return nil 958 } 959 960 func (m *ConsolePortType) validateValue(formats strfmt.Registry) error { 961 962 if err := validate.Required("type"+"."+"value", "body", m.Value); err != nil { 963 return err 964 } 965 966 // value enum 967 if err := m.validateValueEnum("type"+"."+"value", "body", *m.Value); err != nil { 968 return err 969 } 970 971 return nil 972 } 973 974 // ContextValidate validates this console port type based on context it is used 975 func (m *ConsolePortType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 976 return nil 977 } 978 979 // MarshalBinary interface implementation 980 func (m *ConsolePortType) MarshalBinary() ([]byte, error) { 981 if m == nil { 982 return nil, nil 983 } 984 return swag.WriteJSON(m) 985 } 986 987 // UnmarshalBinary interface implementation 988 func (m *ConsolePortType) UnmarshalBinary(b []byte) error { 989 var res ConsolePortType 990 if err := swag.ReadJSON(b, &res); err != nil { 991 return err 992 } 993 *m = res 994 return nil 995 }