github.com/digitalocean/go-netbox@v0.0.2/netbox/models/cable.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 // Cable cable 35 // 36 // swagger:model Cable 37 type Cable struct { 38 39 // Color 40 // Max Length: 6 41 // Pattern: ^[0-9a-f]{6}$ 42 Color string `json:"color,omitempty"` 43 44 // Custom fields 45 CustomFields interface{} `json:"custom_fields,omitempty"` 46 47 // Display 48 // Read Only: true 49 Display string `json:"display,omitempty"` 50 51 // Id 52 // Read Only: true 53 ID int64 `json:"id,omitempty"` 54 55 // Label 56 // Max Length: 100 57 Label string `json:"label,omitempty"` 58 59 // Length 60 // Maximum: 32767 61 // Minimum: 0 62 Length *int64 `json:"length,omitempty"` 63 64 // length unit 65 LengthUnit *CableLengthUnit `json:"length_unit,omitempty"` 66 67 // status 68 Status *CableStatus `json:"status,omitempty"` 69 70 // tags 71 Tags []*NestedTag `json:"tags"` 72 73 // Termination a 74 // Read Only: true 75 Terminationa map[string]*string `json:"termination_a,omitempty"` 76 77 // Termination a id 78 // Required: true 79 // Maximum: 2.147483647e+09 80 // Minimum: 0 81 TerminationaID *int64 `json:"termination_a_id"` 82 83 // Termination a type 84 // Required: true 85 TerminationaType *string `json:"termination_a_type"` 86 87 // Termination b 88 // Read Only: true 89 Terminationb map[string]*string `json:"termination_b,omitempty"` 90 91 // Termination b id 92 // Required: true 93 // Maximum: 2.147483647e+09 94 // Minimum: 0 95 TerminationbID *int64 `json:"termination_b_id"` 96 97 // Termination b type 98 // Required: true 99 TerminationbType *string `json:"termination_b_type"` 100 101 // Type 102 // Enum: [cat3 cat5 cat5e cat6 cat6a cat7 cat7a cat8 dac-active dac-passive mrj21-trunk coaxial mmf mmf-om1 mmf-om2 mmf-om3 mmf-om4 mmf-om5 smf smf-os1 smf-os2 aoc power] 103 Type string `json:"type,omitempty"` 104 105 // Url 106 // Read Only: true 107 // Format: uri 108 URL strfmt.URI `json:"url,omitempty"` 109 } 110 111 // Validate validates this cable 112 func (m *Cable) Validate(formats strfmt.Registry) error { 113 var res []error 114 115 if err := m.validateColor(formats); err != nil { 116 res = append(res, err) 117 } 118 119 if err := m.validateLabel(formats); err != nil { 120 res = append(res, err) 121 } 122 123 if err := m.validateLength(formats); err != nil { 124 res = append(res, err) 125 } 126 127 if err := m.validateLengthUnit(formats); err != nil { 128 res = append(res, err) 129 } 130 131 if err := m.validateStatus(formats); err != nil { 132 res = append(res, err) 133 } 134 135 if err := m.validateTags(formats); err != nil { 136 res = append(res, err) 137 } 138 139 if err := m.validateTerminationaID(formats); err != nil { 140 res = append(res, err) 141 } 142 143 if err := m.validateTerminationaType(formats); err != nil { 144 res = append(res, err) 145 } 146 147 if err := m.validateTerminationbID(formats); err != nil { 148 res = append(res, err) 149 } 150 151 if err := m.validateTerminationbType(formats); err != nil { 152 res = append(res, err) 153 } 154 155 if err := m.validateType(formats); err != nil { 156 res = append(res, err) 157 } 158 159 if err := m.validateURL(formats); err != nil { 160 res = append(res, err) 161 } 162 163 if len(res) > 0 { 164 return errors.CompositeValidationError(res...) 165 } 166 return nil 167 } 168 169 func (m *Cable) validateColor(formats strfmt.Registry) error { 170 if swag.IsZero(m.Color) { // not required 171 return nil 172 } 173 174 if err := validate.MaxLength("color", "body", m.Color, 6); err != nil { 175 return err 176 } 177 178 if err := validate.Pattern("color", "body", m.Color, `^[0-9a-f]{6}$`); err != nil { 179 return err 180 } 181 182 return nil 183 } 184 185 func (m *Cable) validateLabel(formats strfmt.Registry) error { 186 if swag.IsZero(m.Label) { // not required 187 return nil 188 } 189 190 if err := validate.MaxLength("label", "body", m.Label, 100); err != nil { 191 return err 192 } 193 194 return nil 195 } 196 197 func (m *Cable) validateLength(formats strfmt.Registry) error { 198 if swag.IsZero(m.Length) { // not required 199 return nil 200 } 201 202 if err := validate.MinimumInt("length", "body", *m.Length, 0, false); err != nil { 203 return err 204 } 205 206 if err := validate.MaximumInt("length", "body", *m.Length, 32767, false); err != nil { 207 return err 208 } 209 210 return nil 211 } 212 213 func (m *Cable) validateLengthUnit(formats strfmt.Registry) error { 214 if swag.IsZero(m.LengthUnit) { // not required 215 return nil 216 } 217 218 if m.LengthUnit != nil { 219 if err := m.LengthUnit.Validate(formats); err != nil { 220 if ve, ok := err.(*errors.Validation); ok { 221 return ve.ValidateName("length_unit") 222 } else if ce, ok := err.(*errors.CompositeError); ok { 223 return ce.ValidateName("length_unit") 224 } 225 return err 226 } 227 } 228 229 return nil 230 } 231 232 func (m *Cable) validateStatus(formats strfmt.Registry) error { 233 if swag.IsZero(m.Status) { // not required 234 return nil 235 } 236 237 if m.Status != nil { 238 if err := m.Status.Validate(formats); err != nil { 239 if ve, ok := err.(*errors.Validation); ok { 240 return ve.ValidateName("status") 241 } else if ce, ok := err.(*errors.CompositeError); ok { 242 return ce.ValidateName("status") 243 } 244 return err 245 } 246 } 247 248 return nil 249 } 250 251 func (m *Cable) validateTags(formats strfmt.Registry) error { 252 if swag.IsZero(m.Tags) { // not required 253 return nil 254 } 255 256 for i := 0; i < len(m.Tags); i++ { 257 if swag.IsZero(m.Tags[i]) { // not required 258 continue 259 } 260 261 if m.Tags[i] != nil { 262 if err := m.Tags[i].Validate(formats); err != nil { 263 if ve, ok := err.(*errors.Validation); ok { 264 return ve.ValidateName("tags" + "." + strconv.Itoa(i)) 265 } else if ce, ok := err.(*errors.CompositeError); ok { 266 return ce.ValidateName("tags" + "." + strconv.Itoa(i)) 267 } 268 return err 269 } 270 } 271 272 } 273 274 return nil 275 } 276 277 func (m *Cable) validateTerminationaID(formats strfmt.Registry) error { 278 279 if err := validate.Required("termination_a_id", "body", m.TerminationaID); err != nil { 280 return err 281 } 282 283 if err := validate.MinimumInt("termination_a_id", "body", *m.TerminationaID, 0, false); err != nil { 284 return err 285 } 286 287 if err := validate.MaximumInt("termination_a_id", "body", *m.TerminationaID, 2.147483647e+09, false); err != nil { 288 return err 289 } 290 291 return nil 292 } 293 294 func (m *Cable) validateTerminationaType(formats strfmt.Registry) error { 295 296 if err := validate.Required("termination_a_type", "body", m.TerminationaType); err != nil { 297 return err 298 } 299 300 return nil 301 } 302 303 func (m *Cable) validateTerminationbID(formats strfmt.Registry) error { 304 305 if err := validate.Required("termination_b_id", "body", m.TerminationbID); err != nil { 306 return err 307 } 308 309 if err := validate.MinimumInt("termination_b_id", "body", *m.TerminationbID, 0, false); err != nil { 310 return err 311 } 312 313 if err := validate.MaximumInt("termination_b_id", "body", *m.TerminationbID, 2.147483647e+09, false); err != nil { 314 return err 315 } 316 317 return nil 318 } 319 320 func (m *Cable) validateTerminationbType(formats strfmt.Registry) error { 321 322 if err := validate.Required("termination_b_type", "body", m.TerminationbType); err != nil { 323 return err 324 } 325 326 return nil 327 } 328 329 var cableTypeTypePropEnum []interface{} 330 331 func init() { 332 var res []string 333 if err := json.Unmarshal([]byte(`["cat3","cat5","cat5e","cat6","cat6a","cat7","cat7a","cat8","dac-active","dac-passive","mrj21-trunk","coaxial","mmf","mmf-om1","mmf-om2","mmf-om3","mmf-om4","mmf-om5","smf","smf-os1","smf-os2","aoc","power"]`), &res); err != nil { 334 panic(err) 335 } 336 for _, v := range res { 337 cableTypeTypePropEnum = append(cableTypeTypePropEnum, v) 338 } 339 } 340 341 const ( 342 343 // CableTypeCat3 captures enum value "cat3" 344 CableTypeCat3 string = "cat3" 345 346 // CableTypeCat5 captures enum value "cat5" 347 CableTypeCat5 string = "cat5" 348 349 // CableTypeCat5e captures enum value "cat5e" 350 CableTypeCat5e string = "cat5e" 351 352 // CableTypeCat6 captures enum value "cat6" 353 CableTypeCat6 string = "cat6" 354 355 // CableTypeCat6a captures enum value "cat6a" 356 CableTypeCat6a string = "cat6a" 357 358 // CableTypeCat7 captures enum value "cat7" 359 CableTypeCat7 string = "cat7" 360 361 // CableTypeCat7a captures enum value "cat7a" 362 CableTypeCat7a string = "cat7a" 363 364 // CableTypeCat8 captures enum value "cat8" 365 CableTypeCat8 string = "cat8" 366 367 // CableTypeDacDashActive captures enum value "dac-active" 368 CableTypeDacDashActive string = "dac-active" 369 370 // CableTypeDacDashPassive captures enum value "dac-passive" 371 CableTypeDacDashPassive string = "dac-passive" 372 373 // CableTypeMrj21DashTrunk captures enum value "mrj21-trunk" 374 CableTypeMrj21DashTrunk string = "mrj21-trunk" 375 376 // CableTypeCoaxial captures enum value "coaxial" 377 CableTypeCoaxial string = "coaxial" 378 379 // CableTypeMmf captures enum value "mmf" 380 CableTypeMmf string = "mmf" 381 382 // CableTypeMmfDashOm1 captures enum value "mmf-om1" 383 CableTypeMmfDashOm1 string = "mmf-om1" 384 385 // CableTypeMmfDashOm2 captures enum value "mmf-om2" 386 CableTypeMmfDashOm2 string = "mmf-om2" 387 388 // CableTypeMmfDashOm3 captures enum value "mmf-om3" 389 CableTypeMmfDashOm3 string = "mmf-om3" 390 391 // CableTypeMmfDashOm4 captures enum value "mmf-om4" 392 CableTypeMmfDashOm4 string = "mmf-om4" 393 394 // CableTypeMmfDashOm5 captures enum value "mmf-om5" 395 CableTypeMmfDashOm5 string = "mmf-om5" 396 397 // CableTypeSmf captures enum value "smf" 398 CableTypeSmf string = "smf" 399 400 // CableTypeSmfDashOs1 captures enum value "smf-os1" 401 CableTypeSmfDashOs1 string = "smf-os1" 402 403 // CableTypeSmfDashOs2 captures enum value "smf-os2" 404 CableTypeSmfDashOs2 string = "smf-os2" 405 406 // CableTypeAoc captures enum value "aoc" 407 CableTypeAoc string = "aoc" 408 409 // CableTypePower captures enum value "power" 410 CableTypePower string = "power" 411 ) 412 413 // prop value enum 414 func (m *Cable) validateTypeEnum(path, location string, value string) error { 415 if err := validate.EnumCase(path, location, value, cableTypeTypePropEnum, true); err != nil { 416 return err 417 } 418 return nil 419 } 420 421 func (m *Cable) validateType(formats strfmt.Registry) error { 422 if swag.IsZero(m.Type) { // not required 423 return nil 424 } 425 426 // value enum 427 if err := m.validateTypeEnum("type", "body", m.Type); err != nil { 428 return err 429 } 430 431 return nil 432 } 433 434 func (m *Cable) validateURL(formats strfmt.Registry) error { 435 if swag.IsZero(m.URL) { // not required 436 return nil 437 } 438 439 if err := validate.FormatOf("url", "body", "uri", m.URL.String(), formats); err != nil { 440 return err 441 } 442 443 return nil 444 } 445 446 // ContextValidate validate this cable based on the context it is used 447 func (m *Cable) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 448 var res []error 449 450 if err := m.contextValidateDisplay(ctx, formats); err != nil { 451 res = append(res, err) 452 } 453 454 if err := m.contextValidateID(ctx, formats); err != nil { 455 res = append(res, err) 456 } 457 458 if err := m.contextValidateLengthUnit(ctx, formats); err != nil { 459 res = append(res, err) 460 } 461 462 if err := m.contextValidateStatus(ctx, formats); err != nil { 463 res = append(res, err) 464 } 465 466 if err := m.contextValidateTags(ctx, formats); err != nil { 467 res = append(res, err) 468 } 469 470 if err := m.contextValidateTerminationa(ctx, formats); err != nil { 471 res = append(res, err) 472 } 473 474 if err := m.contextValidateTerminationb(ctx, formats); err != nil { 475 res = append(res, err) 476 } 477 478 if err := m.contextValidateURL(ctx, formats); err != nil { 479 res = append(res, err) 480 } 481 482 if len(res) > 0 { 483 return errors.CompositeValidationError(res...) 484 } 485 return nil 486 } 487 488 func (m *Cable) contextValidateDisplay(ctx context.Context, formats strfmt.Registry) error { 489 490 if err := validate.ReadOnly(ctx, "display", "body", string(m.Display)); err != nil { 491 return err 492 } 493 494 return nil 495 } 496 497 func (m *Cable) contextValidateID(ctx context.Context, formats strfmt.Registry) error { 498 499 if err := validate.ReadOnly(ctx, "id", "body", int64(m.ID)); err != nil { 500 return err 501 } 502 503 return nil 504 } 505 506 func (m *Cable) contextValidateLengthUnit(ctx context.Context, formats strfmt.Registry) error { 507 508 if m.LengthUnit != nil { 509 if err := m.LengthUnit.ContextValidate(ctx, formats); err != nil { 510 if ve, ok := err.(*errors.Validation); ok { 511 return ve.ValidateName("length_unit") 512 } else if ce, ok := err.(*errors.CompositeError); ok { 513 return ce.ValidateName("length_unit") 514 } 515 return err 516 } 517 } 518 519 return nil 520 } 521 522 func (m *Cable) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { 523 524 if m.Status != nil { 525 if err := m.Status.ContextValidate(ctx, formats); err != nil { 526 if ve, ok := err.(*errors.Validation); ok { 527 return ve.ValidateName("status") 528 } else if ce, ok := err.(*errors.CompositeError); ok { 529 return ce.ValidateName("status") 530 } 531 return err 532 } 533 } 534 535 return nil 536 } 537 538 func (m *Cable) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { 539 540 for i := 0; i < len(m.Tags); i++ { 541 542 if m.Tags[i] != nil { 543 if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { 544 if ve, ok := err.(*errors.Validation); ok { 545 return ve.ValidateName("tags" + "." + strconv.Itoa(i)) 546 } else if ce, ok := err.(*errors.CompositeError); ok { 547 return ce.ValidateName("tags" + "." + strconv.Itoa(i)) 548 } 549 return err 550 } 551 } 552 553 } 554 555 return nil 556 } 557 558 func (m *Cable) contextValidateTerminationa(ctx context.Context, formats strfmt.Registry) error { 559 560 return nil 561 } 562 563 func (m *Cable) contextValidateTerminationb(ctx context.Context, formats strfmt.Registry) error { 564 565 return nil 566 } 567 568 func (m *Cable) contextValidateURL(ctx context.Context, formats strfmt.Registry) error { 569 570 if err := validate.ReadOnly(ctx, "url", "body", strfmt.URI(m.URL)); err != nil { 571 return err 572 } 573 574 return nil 575 } 576 577 // MarshalBinary interface implementation 578 func (m *Cable) MarshalBinary() ([]byte, error) { 579 if m == nil { 580 return nil, nil 581 } 582 return swag.WriteJSON(m) 583 } 584 585 // UnmarshalBinary interface implementation 586 func (m *Cable) UnmarshalBinary(b []byte) error { 587 var res Cable 588 if err := swag.ReadJSON(b, &res); err != nil { 589 return err 590 } 591 *m = res 592 return nil 593 } 594 595 // CableLengthUnit Length unit 596 // 597 // swagger:model CableLengthUnit 598 type CableLengthUnit struct { 599 600 // label 601 // Required: true 602 // Enum: [Meters Centimeters Feet Inches] 603 Label *string `json:"label"` 604 605 // value 606 // Required: true 607 // Enum: [m cm ft in] 608 Value *string `json:"value"` 609 } 610 611 // Validate validates this cable length unit 612 func (m *CableLengthUnit) Validate(formats strfmt.Registry) error { 613 var res []error 614 615 if err := m.validateLabel(formats); err != nil { 616 res = append(res, err) 617 } 618 619 if err := m.validateValue(formats); err != nil { 620 res = append(res, err) 621 } 622 623 if len(res) > 0 { 624 return errors.CompositeValidationError(res...) 625 } 626 return nil 627 } 628 629 var cableLengthUnitTypeLabelPropEnum []interface{} 630 631 func init() { 632 var res []string 633 if err := json.Unmarshal([]byte(`["Meters","Centimeters","Feet","Inches"]`), &res); err != nil { 634 panic(err) 635 } 636 for _, v := range res { 637 cableLengthUnitTypeLabelPropEnum = append(cableLengthUnitTypeLabelPropEnum, v) 638 } 639 } 640 641 const ( 642 643 // CableLengthUnitLabelMeters captures enum value "Meters" 644 CableLengthUnitLabelMeters string = "Meters" 645 646 // CableLengthUnitLabelCentimeters captures enum value "Centimeters" 647 CableLengthUnitLabelCentimeters string = "Centimeters" 648 649 // CableLengthUnitLabelFeet captures enum value "Feet" 650 CableLengthUnitLabelFeet string = "Feet" 651 652 // CableLengthUnitLabelInches captures enum value "Inches" 653 CableLengthUnitLabelInches string = "Inches" 654 ) 655 656 // prop value enum 657 func (m *CableLengthUnit) validateLabelEnum(path, location string, value string) error { 658 if err := validate.EnumCase(path, location, value, cableLengthUnitTypeLabelPropEnum, true); err != nil { 659 return err 660 } 661 return nil 662 } 663 664 func (m *CableLengthUnit) validateLabel(formats strfmt.Registry) error { 665 666 if err := validate.Required("length_unit"+"."+"label", "body", m.Label); err != nil { 667 return err 668 } 669 670 // value enum 671 if err := m.validateLabelEnum("length_unit"+"."+"label", "body", *m.Label); err != nil { 672 return err 673 } 674 675 return nil 676 } 677 678 var cableLengthUnitTypeValuePropEnum []interface{} 679 680 func init() { 681 var res []string 682 if err := json.Unmarshal([]byte(`["m","cm","ft","in"]`), &res); err != nil { 683 panic(err) 684 } 685 for _, v := range res { 686 cableLengthUnitTypeValuePropEnum = append(cableLengthUnitTypeValuePropEnum, v) 687 } 688 } 689 690 const ( 691 692 // CableLengthUnitValueM captures enum value "m" 693 CableLengthUnitValueM string = "m" 694 695 // CableLengthUnitValueCm captures enum value "cm" 696 CableLengthUnitValueCm string = "cm" 697 698 // CableLengthUnitValueFt captures enum value "ft" 699 CableLengthUnitValueFt string = "ft" 700 701 // CableLengthUnitValueIn captures enum value "in" 702 CableLengthUnitValueIn string = "in" 703 ) 704 705 // prop value enum 706 func (m *CableLengthUnit) validateValueEnum(path, location string, value string) error { 707 if err := validate.EnumCase(path, location, value, cableLengthUnitTypeValuePropEnum, true); err != nil { 708 return err 709 } 710 return nil 711 } 712 713 func (m *CableLengthUnit) validateValue(formats strfmt.Registry) error { 714 715 if err := validate.Required("length_unit"+"."+"value", "body", m.Value); err != nil { 716 return err 717 } 718 719 // value enum 720 if err := m.validateValueEnum("length_unit"+"."+"value", "body", *m.Value); err != nil { 721 return err 722 } 723 724 return nil 725 } 726 727 // ContextValidate validates this cable length unit based on context it is used 728 func (m *CableLengthUnit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 729 return nil 730 } 731 732 // MarshalBinary interface implementation 733 func (m *CableLengthUnit) MarshalBinary() ([]byte, error) { 734 if m == nil { 735 return nil, nil 736 } 737 return swag.WriteJSON(m) 738 } 739 740 // UnmarshalBinary interface implementation 741 func (m *CableLengthUnit) UnmarshalBinary(b []byte) error { 742 var res CableLengthUnit 743 if err := swag.ReadJSON(b, &res); err != nil { 744 return err 745 } 746 *m = res 747 return nil 748 } 749 750 // CableStatus Status 751 // 752 // swagger:model CableStatus 753 type CableStatus struct { 754 755 // label 756 // Required: true 757 // Enum: [Connected Planned Decommissioning] 758 Label *string `json:"label"` 759 760 // value 761 // Required: true 762 // Enum: [connected planned decommissioning] 763 Value *string `json:"value"` 764 } 765 766 // Validate validates this cable status 767 func (m *CableStatus) Validate(formats strfmt.Registry) error { 768 var res []error 769 770 if err := m.validateLabel(formats); err != nil { 771 res = append(res, err) 772 } 773 774 if err := m.validateValue(formats); err != nil { 775 res = append(res, err) 776 } 777 778 if len(res) > 0 { 779 return errors.CompositeValidationError(res...) 780 } 781 return nil 782 } 783 784 var cableStatusTypeLabelPropEnum []interface{} 785 786 func init() { 787 var res []string 788 if err := json.Unmarshal([]byte(`["Connected","Planned","Decommissioning"]`), &res); err != nil { 789 panic(err) 790 } 791 for _, v := range res { 792 cableStatusTypeLabelPropEnum = append(cableStatusTypeLabelPropEnum, v) 793 } 794 } 795 796 const ( 797 798 // CableStatusLabelConnected captures enum value "Connected" 799 CableStatusLabelConnected string = "Connected" 800 801 // CableStatusLabelPlanned captures enum value "Planned" 802 CableStatusLabelPlanned string = "Planned" 803 804 // CableStatusLabelDecommissioning captures enum value "Decommissioning" 805 CableStatusLabelDecommissioning string = "Decommissioning" 806 ) 807 808 // prop value enum 809 func (m *CableStatus) validateLabelEnum(path, location string, value string) error { 810 if err := validate.EnumCase(path, location, value, cableStatusTypeLabelPropEnum, true); err != nil { 811 return err 812 } 813 return nil 814 } 815 816 func (m *CableStatus) validateLabel(formats strfmt.Registry) error { 817 818 if err := validate.Required("status"+"."+"label", "body", m.Label); err != nil { 819 return err 820 } 821 822 // value enum 823 if err := m.validateLabelEnum("status"+"."+"label", "body", *m.Label); err != nil { 824 return err 825 } 826 827 return nil 828 } 829 830 var cableStatusTypeValuePropEnum []interface{} 831 832 func init() { 833 var res []string 834 if err := json.Unmarshal([]byte(`["connected","planned","decommissioning"]`), &res); err != nil { 835 panic(err) 836 } 837 for _, v := range res { 838 cableStatusTypeValuePropEnum = append(cableStatusTypeValuePropEnum, v) 839 } 840 } 841 842 const ( 843 844 // CableStatusValueConnected captures enum value "connected" 845 CableStatusValueConnected string = "connected" 846 847 // CableStatusValuePlanned captures enum value "planned" 848 CableStatusValuePlanned string = "planned" 849 850 // CableStatusValueDecommissioning captures enum value "decommissioning" 851 CableStatusValueDecommissioning string = "decommissioning" 852 ) 853 854 // prop value enum 855 func (m *CableStatus) validateValueEnum(path, location string, value string) error { 856 if err := validate.EnumCase(path, location, value, cableStatusTypeValuePropEnum, true); err != nil { 857 return err 858 } 859 return nil 860 } 861 862 func (m *CableStatus) validateValue(formats strfmt.Registry) error { 863 864 if err := validate.Required("status"+"."+"value", "body", m.Value); err != nil { 865 return err 866 } 867 868 // value enum 869 if err := m.validateValueEnum("status"+"."+"value", "body", *m.Value); err != nil { 870 return err 871 } 872 873 return nil 874 } 875 876 // ContextValidate validates this cable status based on context it is used 877 func (m *CableStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 878 return nil 879 } 880 881 // MarshalBinary interface implementation 882 func (m *CableStatus) MarshalBinary() ([]byte, error) { 883 if m == nil { 884 return nil, nil 885 } 886 return swag.WriteJSON(m) 887 } 888 889 // UnmarshalBinary interface implementation 890 func (m *CableStatus) UnmarshalBinary(b []byte) error { 891 var res CableStatus 892 if err := swag.ReadJSON(b, &res); err != nil { 893 return err 894 } 895 *m = res 896 return nil 897 }