github.com/digitalocean/go-netbox@v0.0.2/netbox/models/front_port_template.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 27 "github.com/go-openapi/errors" 28 "github.com/go-openapi/strfmt" 29 "github.com/go-openapi/swag" 30 "github.com/go-openapi/validate" 31 ) 32 33 // FrontPortTemplate front port template 34 // 35 // swagger:model FrontPortTemplate 36 type FrontPortTemplate struct { 37 38 // Created 39 // Read Only: true 40 // Format: date 41 Created strfmt.Date `json:"created,omitempty"` 42 43 // Description 44 // Max Length: 200 45 Description string `json:"description,omitempty"` 46 47 // device type 48 // Required: true 49 DeviceType *NestedDeviceType `json:"device_type"` 50 51 // Display 52 // Read Only: true 53 Display string `json:"display,omitempty"` 54 55 // Id 56 // Read Only: true 57 ID int64 `json:"id,omitempty"` 58 59 // Label 60 // 61 // Physical label 62 // Max Length: 64 63 Label string `json:"label,omitempty"` 64 65 // Last updated 66 // Read Only: true 67 // Format: date-time 68 LastUpdated strfmt.DateTime `json:"last_updated,omitempty"` 69 70 // Name 71 // Required: true 72 // Max Length: 64 73 // Min Length: 1 74 Name *string `json:"name"` 75 76 // rear port 77 // Required: true 78 RearPort *NestedRearPortTemplate `json:"rear_port"` 79 80 // Rear port position 81 // Maximum: 1024 82 // Minimum: 1 83 RearPortPosition int64 `json:"rear_port_position,omitempty"` 84 85 // type 86 // Required: true 87 Type *FrontPortTemplateType `json:"type"` 88 89 // Url 90 // Read Only: true 91 // Format: uri 92 URL strfmt.URI `json:"url,omitempty"` 93 } 94 95 // Validate validates this front port template 96 func (m *FrontPortTemplate) Validate(formats strfmt.Registry) error { 97 var res []error 98 99 if err := m.validateCreated(formats); err != nil { 100 res = append(res, err) 101 } 102 103 if err := m.validateDescription(formats); err != nil { 104 res = append(res, err) 105 } 106 107 if err := m.validateDeviceType(formats); err != nil { 108 res = append(res, err) 109 } 110 111 if err := m.validateLabel(formats); err != nil { 112 res = append(res, err) 113 } 114 115 if err := m.validateLastUpdated(formats); err != nil { 116 res = append(res, err) 117 } 118 119 if err := m.validateName(formats); err != nil { 120 res = append(res, err) 121 } 122 123 if err := m.validateRearPort(formats); err != nil { 124 res = append(res, err) 125 } 126 127 if err := m.validateRearPortPosition(formats); err != nil { 128 res = append(res, err) 129 } 130 131 if err := m.validateType(formats); err != nil { 132 res = append(res, err) 133 } 134 135 if err := m.validateURL(formats); err != nil { 136 res = append(res, err) 137 } 138 139 if len(res) > 0 { 140 return errors.CompositeValidationError(res...) 141 } 142 return nil 143 } 144 145 func (m *FrontPortTemplate) validateCreated(formats strfmt.Registry) error { 146 if swag.IsZero(m.Created) { // not required 147 return nil 148 } 149 150 if err := validate.FormatOf("created", "body", "date", m.Created.String(), formats); err != nil { 151 return err 152 } 153 154 return nil 155 } 156 157 func (m *FrontPortTemplate) validateDescription(formats strfmt.Registry) error { 158 if swag.IsZero(m.Description) { // not required 159 return nil 160 } 161 162 if err := validate.MaxLength("description", "body", m.Description, 200); err != nil { 163 return err 164 } 165 166 return nil 167 } 168 169 func (m *FrontPortTemplate) validateDeviceType(formats strfmt.Registry) error { 170 171 if err := validate.Required("device_type", "body", m.DeviceType); err != nil { 172 return err 173 } 174 175 if m.DeviceType != nil { 176 if err := m.DeviceType.Validate(formats); err != nil { 177 if ve, ok := err.(*errors.Validation); ok { 178 return ve.ValidateName("device_type") 179 } else if ce, ok := err.(*errors.CompositeError); ok { 180 return ce.ValidateName("device_type") 181 } 182 return err 183 } 184 } 185 186 return nil 187 } 188 189 func (m *FrontPortTemplate) validateLabel(formats strfmt.Registry) error { 190 if swag.IsZero(m.Label) { // not required 191 return nil 192 } 193 194 if err := validate.MaxLength("label", "body", m.Label, 64); err != nil { 195 return err 196 } 197 198 return nil 199 } 200 201 func (m *FrontPortTemplate) validateLastUpdated(formats strfmt.Registry) error { 202 if swag.IsZero(m.LastUpdated) { // not required 203 return nil 204 } 205 206 if err := validate.FormatOf("last_updated", "body", "date-time", m.LastUpdated.String(), formats); err != nil { 207 return err 208 } 209 210 return nil 211 } 212 213 func (m *FrontPortTemplate) validateName(formats strfmt.Registry) error { 214 215 if err := validate.Required("name", "body", m.Name); err != nil { 216 return err 217 } 218 219 if err := validate.MinLength("name", "body", *m.Name, 1); err != nil { 220 return err 221 } 222 223 if err := validate.MaxLength("name", "body", *m.Name, 64); err != nil { 224 return err 225 } 226 227 return nil 228 } 229 230 func (m *FrontPortTemplate) validateRearPort(formats strfmt.Registry) error { 231 232 if err := validate.Required("rear_port", "body", m.RearPort); err != nil { 233 return err 234 } 235 236 if m.RearPort != nil { 237 if err := m.RearPort.Validate(formats); err != nil { 238 if ve, ok := err.(*errors.Validation); ok { 239 return ve.ValidateName("rear_port") 240 } else if ce, ok := err.(*errors.CompositeError); ok { 241 return ce.ValidateName("rear_port") 242 } 243 return err 244 } 245 } 246 247 return nil 248 } 249 250 func (m *FrontPortTemplate) validateRearPortPosition(formats strfmt.Registry) error { 251 if swag.IsZero(m.RearPortPosition) { // not required 252 return nil 253 } 254 255 if err := validate.MinimumInt("rear_port_position", "body", m.RearPortPosition, 1, false); err != nil { 256 return err 257 } 258 259 if err := validate.MaximumInt("rear_port_position", "body", m.RearPortPosition, 1024, false); err != nil { 260 return err 261 } 262 263 return nil 264 } 265 266 func (m *FrontPortTemplate) validateType(formats strfmt.Registry) error { 267 268 if err := validate.Required("type", "body", m.Type); err != nil { 269 return err 270 } 271 272 if m.Type != nil { 273 if err := m.Type.Validate(formats); err != nil { 274 if ve, ok := err.(*errors.Validation); ok { 275 return ve.ValidateName("type") 276 } else if ce, ok := err.(*errors.CompositeError); ok { 277 return ce.ValidateName("type") 278 } 279 return err 280 } 281 } 282 283 return nil 284 } 285 286 func (m *FrontPortTemplate) validateURL(formats strfmt.Registry) error { 287 if swag.IsZero(m.URL) { // not required 288 return nil 289 } 290 291 if err := validate.FormatOf("url", "body", "uri", m.URL.String(), formats); err != nil { 292 return err 293 } 294 295 return nil 296 } 297 298 // ContextValidate validate this front port template based on the context it is used 299 func (m *FrontPortTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 300 var res []error 301 302 if err := m.contextValidateCreated(ctx, formats); err != nil { 303 res = append(res, err) 304 } 305 306 if err := m.contextValidateDeviceType(ctx, formats); err != nil { 307 res = append(res, err) 308 } 309 310 if err := m.contextValidateDisplay(ctx, formats); err != nil { 311 res = append(res, err) 312 } 313 314 if err := m.contextValidateID(ctx, formats); err != nil { 315 res = append(res, err) 316 } 317 318 if err := m.contextValidateLastUpdated(ctx, formats); err != nil { 319 res = append(res, err) 320 } 321 322 if err := m.contextValidateRearPort(ctx, formats); err != nil { 323 res = append(res, err) 324 } 325 326 if err := m.contextValidateType(ctx, formats); err != nil { 327 res = append(res, err) 328 } 329 330 if err := m.contextValidateURL(ctx, formats); err != nil { 331 res = append(res, err) 332 } 333 334 if len(res) > 0 { 335 return errors.CompositeValidationError(res...) 336 } 337 return nil 338 } 339 340 func (m *FrontPortTemplate) contextValidateCreated(ctx context.Context, formats strfmt.Registry) error { 341 342 if err := validate.ReadOnly(ctx, "created", "body", strfmt.Date(m.Created)); err != nil { 343 return err 344 } 345 346 return nil 347 } 348 349 func (m *FrontPortTemplate) contextValidateDeviceType(ctx context.Context, formats strfmt.Registry) error { 350 351 if m.DeviceType != nil { 352 if err := m.DeviceType.ContextValidate(ctx, formats); err != nil { 353 if ve, ok := err.(*errors.Validation); ok { 354 return ve.ValidateName("device_type") 355 } else if ce, ok := err.(*errors.CompositeError); ok { 356 return ce.ValidateName("device_type") 357 } 358 return err 359 } 360 } 361 362 return nil 363 } 364 365 func (m *FrontPortTemplate) contextValidateDisplay(ctx context.Context, formats strfmt.Registry) error { 366 367 if err := validate.ReadOnly(ctx, "display", "body", string(m.Display)); err != nil { 368 return err 369 } 370 371 return nil 372 } 373 374 func (m *FrontPortTemplate) contextValidateID(ctx context.Context, formats strfmt.Registry) error { 375 376 if err := validate.ReadOnly(ctx, "id", "body", int64(m.ID)); err != nil { 377 return err 378 } 379 380 return nil 381 } 382 383 func (m *FrontPortTemplate) contextValidateLastUpdated(ctx context.Context, formats strfmt.Registry) error { 384 385 if err := validate.ReadOnly(ctx, "last_updated", "body", strfmt.DateTime(m.LastUpdated)); err != nil { 386 return err 387 } 388 389 return nil 390 } 391 392 func (m *FrontPortTemplate) contextValidateRearPort(ctx context.Context, formats strfmt.Registry) error { 393 394 if m.RearPort != nil { 395 if err := m.RearPort.ContextValidate(ctx, formats); err != nil { 396 if ve, ok := err.(*errors.Validation); ok { 397 return ve.ValidateName("rear_port") 398 } else if ce, ok := err.(*errors.CompositeError); ok { 399 return ce.ValidateName("rear_port") 400 } 401 return err 402 } 403 } 404 405 return nil 406 } 407 408 func (m *FrontPortTemplate) contextValidateType(ctx context.Context, formats strfmt.Registry) error { 409 410 if m.Type != nil { 411 if err := m.Type.ContextValidate(ctx, formats); err != nil { 412 if ve, ok := err.(*errors.Validation); ok { 413 return ve.ValidateName("type") 414 } else if ce, ok := err.(*errors.CompositeError); ok { 415 return ce.ValidateName("type") 416 } 417 return err 418 } 419 } 420 421 return nil 422 } 423 424 func (m *FrontPortTemplate) contextValidateURL(ctx context.Context, formats strfmt.Registry) error { 425 426 if err := validate.ReadOnly(ctx, "url", "body", strfmt.URI(m.URL)); err != nil { 427 return err 428 } 429 430 return nil 431 } 432 433 // MarshalBinary interface implementation 434 func (m *FrontPortTemplate) MarshalBinary() ([]byte, error) { 435 if m == nil { 436 return nil, nil 437 } 438 return swag.WriteJSON(m) 439 } 440 441 // UnmarshalBinary interface implementation 442 func (m *FrontPortTemplate) UnmarshalBinary(b []byte) error { 443 var res FrontPortTemplate 444 if err := swag.ReadJSON(b, &res); err != nil { 445 return err 446 } 447 *m = res 448 return nil 449 } 450 451 // FrontPortTemplateType Type 452 // 453 // swagger:model FrontPortTemplateType 454 type FrontPortTemplateType struct { 455 456 // label 457 // Required: true 458 // Enum: [8P8C 8P6C 8P4C 8P2C 6P6C 6P4C 6P2C 4P4C 4P2C GG45 TERA 4P TERA 2P TERA 1P 110 Punch BNC F Connector N Connector MRJ21 FC LC LC/APC LSH LSH/APC MPO MTRJ SC SC/APC ST CS SN Splice] 459 Label *string `json:"label"` 460 461 // value 462 // Required: true 463 // Enum: [8p8c 8p6c 8p4c 8p2c 6p6c 6p4c 6p2c 4p4c 4p2c gg45 tera-4p tera-2p tera-1p 110-punch bnc f n mrj21 fc lc lc-apc lsh lsh-apc mpo mtrj sc sc-apc st cs sn splice] 464 Value *string `json:"value"` 465 } 466 467 // Validate validates this front port template type 468 func (m *FrontPortTemplateType) Validate(formats strfmt.Registry) error { 469 var res []error 470 471 if err := m.validateLabel(formats); err != nil { 472 res = append(res, err) 473 } 474 475 if err := m.validateValue(formats); err != nil { 476 res = append(res, err) 477 } 478 479 if len(res) > 0 { 480 return errors.CompositeValidationError(res...) 481 } 482 return nil 483 } 484 485 var frontPortTemplateTypeTypeLabelPropEnum []interface{} 486 487 func init() { 488 var res []string 489 if err := json.Unmarshal([]byte(`["8P8C","8P6C","8P4C","8P2C","6P6C","6P4C","6P2C","4P4C","4P2C","GG45","TERA 4P","TERA 2P","TERA 1P","110 Punch","BNC","F Connector","N Connector","MRJ21","FC","LC","LC/APC","LSH","LSH/APC","MPO","MTRJ","SC","SC/APC","ST","CS","SN","Splice"]`), &res); err != nil { 490 panic(err) 491 } 492 for _, v := range res { 493 frontPortTemplateTypeTypeLabelPropEnum = append(frontPortTemplateTypeTypeLabelPropEnum, v) 494 } 495 } 496 497 const ( 498 499 // FrontPortTemplateTypeLabelNr8P8C captures enum value "8P8C" 500 FrontPortTemplateTypeLabelNr8P8C string = "8P8C" 501 502 // FrontPortTemplateTypeLabelNr8P6C captures enum value "8P6C" 503 FrontPortTemplateTypeLabelNr8P6C string = "8P6C" 504 505 // FrontPortTemplateTypeLabelNr8P4C captures enum value "8P4C" 506 FrontPortTemplateTypeLabelNr8P4C string = "8P4C" 507 508 // FrontPortTemplateTypeLabelNr8P2C captures enum value "8P2C" 509 FrontPortTemplateTypeLabelNr8P2C string = "8P2C" 510 511 // FrontPortTemplateTypeLabelNr6P6C captures enum value "6P6C" 512 FrontPortTemplateTypeLabelNr6P6C string = "6P6C" 513 514 // FrontPortTemplateTypeLabelNr6P4C captures enum value "6P4C" 515 FrontPortTemplateTypeLabelNr6P4C string = "6P4C" 516 517 // FrontPortTemplateTypeLabelNr6P2C captures enum value "6P2C" 518 FrontPortTemplateTypeLabelNr6P2C string = "6P2C" 519 520 // FrontPortTemplateTypeLabelNr4P4C captures enum value "4P4C" 521 FrontPortTemplateTypeLabelNr4P4C string = "4P4C" 522 523 // FrontPortTemplateTypeLabelNr4P2C captures enum value "4P2C" 524 FrontPortTemplateTypeLabelNr4P2C string = "4P2C" 525 526 // FrontPortTemplateTypeLabelGG45 captures enum value "GG45" 527 FrontPortTemplateTypeLabelGG45 string = "GG45" 528 529 // FrontPortTemplateTypeLabelTERA4P captures enum value "TERA 4P" 530 FrontPortTemplateTypeLabelTERA4P string = "TERA 4P" 531 532 // FrontPortTemplateTypeLabelTERA2P captures enum value "TERA 2P" 533 FrontPortTemplateTypeLabelTERA2P string = "TERA 2P" 534 535 // FrontPortTemplateTypeLabelTERA1P captures enum value "TERA 1P" 536 FrontPortTemplateTypeLabelTERA1P string = "TERA 1P" 537 538 // FrontPortTemplateTypeLabelNr110Punch captures enum value "110 Punch" 539 FrontPortTemplateTypeLabelNr110Punch string = "110 Punch" 540 541 // FrontPortTemplateTypeLabelBNC captures enum value "BNC" 542 FrontPortTemplateTypeLabelBNC string = "BNC" 543 544 // FrontPortTemplateTypeLabelFConnector captures enum value "F Connector" 545 FrontPortTemplateTypeLabelFConnector string = "F Connector" 546 547 // FrontPortTemplateTypeLabelNConnector captures enum value "N Connector" 548 FrontPortTemplateTypeLabelNConnector string = "N Connector" 549 550 // FrontPortTemplateTypeLabelMRJ21 captures enum value "MRJ21" 551 FrontPortTemplateTypeLabelMRJ21 string = "MRJ21" 552 553 // FrontPortTemplateTypeLabelFC captures enum value "FC" 554 FrontPortTemplateTypeLabelFC string = "FC" 555 556 // FrontPortTemplateTypeLabelLC captures enum value "LC" 557 FrontPortTemplateTypeLabelLC string = "LC" 558 559 // FrontPortTemplateTypeLabelLCAPC captures enum value "LC/APC" 560 FrontPortTemplateTypeLabelLCAPC string = "LC/APC" 561 562 // FrontPortTemplateTypeLabelLSH captures enum value "LSH" 563 FrontPortTemplateTypeLabelLSH string = "LSH" 564 565 // FrontPortTemplateTypeLabelLSHAPC captures enum value "LSH/APC" 566 FrontPortTemplateTypeLabelLSHAPC string = "LSH/APC" 567 568 // FrontPortTemplateTypeLabelMPO captures enum value "MPO" 569 FrontPortTemplateTypeLabelMPO string = "MPO" 570 571 // FrontPortTemplateTypeLabelMTRJ captures enum value "MTRJ" 572 FrontPortTemplateTypeLabelMTRJ string = "MTRJ" 573 574 // FrontPortTemplateTypeLabelSC captures enum value "SC" 575 FrontPortTemplateTypeLabelSC string = "SC" 576 577 // FrontPortTemplateTypeLabelSCAPC captures enum value "SC/APC" 578 FrontPortTemplateTypeLabelSCAPC string = "SC/APC" 579 580 // FrontPortTemplateTypeLabelST captures enum value "ST" 581 FrontPortTemplateTypeLabelST string = "ST" 582 583 // FrontPortTemplateTypeLabelCS captures enum value "CS" 584 FrontPortTemplateTypeLabelCS string = "CS" 585 586 // FrontPortTemplateTypeLabelSN captures enum value "SN" 587 FrontPortTemplateTypeLabelSN string = "SN" 588 589 // FrontPortTemplateTypeLabelSplice captures enum value "Splice" 590 FrontPortTemplateTypeLabelSplice string = "Splice" 591 ) 592 593 // prop value enum 594 func (m *FrontPortTemplateType) validateLabelEnum(path, location string, value string) error { 595 if err := validate.EnumCase(path, location, value, frontPortTemplateTypeTypeLabelPropEnum, true); err != nil { 596 return err 597 } 598 return nil 599 } 600 601 func (m *FrontPortTemplateType) validateLabel(formats strfmt.Registry) error { 602 603 if err := validate.Required("type"+"."+"label", "body", m.Label); err != nil { 604 return err 605 } 606 607 // value enum 608 if err := m.validateLabelEnum("type"+"."+"label", "body", *m.Label); err != nil { 609 return err 610 } 611 612 return nil 613 } 614 615 var frontPortTemplateTypeTypeValuePropEnum []interface{} 616 617 func init() { 618 var res []string 619 if err := json.Unmarshal([]byte(`["8p8c","8p6c","8p4c","8p2c","6p6c","6p4c","6p2c","4p4c","4p2c","gg45","tera-4p","tera-2p","tera-1p","110-punch","bnc","f","n","mrj21","fc","lc","lc-apc","lsh","lsh-apc","mpo","mtrj","sc","sc-apc","st","cs","sn","splice"]`), &res); err != nil { 620 panic(err) 621 } 622 for _, v := range res { 623 frontPortTemplateTypeTypeValuePropEnum = append(frontPortTemplateTypeTypeValuePropEnum, v) 624 } 625 } 626 627 const ( 628 629 // FrontPortTemplateTypeValueNr8p8c captures enum value "8p8c" 630 FrontPortTemplateTypeValueNr8p8c string = "8p8c" 631 632 // FrontPortTemplateTypeValueNr8p6c captures enum value "8p6c" 633 FrontPortTemplateTypeValueNr8p6c string = "8p6c" 634 635 // FrontPortTemplateTypeValueNr8p4c captures enum value "8p4c" 636 FrontPortTemplateTypeValueNr8p4c string = "8p4c" 637 638 // FrontPortTemplateTypeValueNr8p2c captures enum value "8p2c" 639 FrontPortTemplateTypeValueNr8p2c string = "8p2c" 640 641 // FrontPortTemplateTypeValueNr6p6c captures enum value "6p6c" 642 FrontPortTemplateTypeValueNr6p6c string = "6p6c" 643 644 // FrontPortTemplateTypeValueNr6p4c captures enum value "6p4c" 645 FrontPortTemplateTypeValueNr6p4c string = "6p4c" 646 647 // FrontPortTemplateTypeValueNr6p2c captures enum value "6p2c" 648 FrontPortTemplateTypeValueNr6p2c string = "6p2c" 649 650 // FrontPortTemplateTypeValueNr4p4c captures enum value "4p4c" 651 FrontPortTemplateTypeValueNr4p4c string = "4p4c" 652 653 // FrontPortTemplateTypeValueNr4p2c captures enum value "4p2c" 654 FrontPortTemplateTypeValueNr4p2c string = "4p2c" 655 656 // FrontPortTemplateTypeValueGg45 captures enum value "gg45" 657 FrontPortTemplateTypeValueGg45 string = "gg45" 658 659 // FrontPortTemplateTypeValueTeraDash4p captures enum value "tera-4p" 660 FrontPortTemplateTypeValueTeraDash4p string = "tera-4p" 661 662 // FrontPortTemplateTypeValueTeraDash2p captures enum value "tera-2p" 663 FrontPortTemplateTypeValueTeraDash2p string = "tera-2p" 664 665 // FrontPortTemplateTypeValueTeraDash1p captures enum value "tera-1p" 666 FrontPortTemplateTypeValueTeraDash1p string = "tera-1p" 667 668 // FrontPortTemplateTypeValueNr110DashPunch captures enum value "110-punch" 669 FrontPortTemplateTypeValueNr110DashPunch string = "110-punch" 670 671 // FrontPortTemplateTypeValueBnc captures enum value "bnc" 672 FrontPortTemplateTypeValueBnc string = "bnc" 673 674 // FrontPortTemplateTypeValueF captures enum value "f" 675 FrontPortTemplateTypeValueF string = "f" 676 677 // FrontPortTemplateTypeValueN captures enum value "n" 678 FrontPortTemplateTypeValueN string = "n" 679 680 // FrontPortTemplateTypeValueMrj21 captures enum value "mrj21" 681 FrontPortTemplateTypeValueMrj21 string = "mrj21" 682 683 // FrontPortTemplateTypeValueFc captures enum value "fc" 684 FrontPortTemplateTypeValueFc string = "fc" 685 686 // FrontPortTemplateTypeValueLc captures enum value "lc" 687 FrontPortTemplateTypeValueLc string = "lc" 688 689 // FrontPortTemplateTypeValueLcDashApc captures enum value "lc-apc" 690 FrontPortTemplateTypeValueLcDashApc string = "lc-apc" 691 692 // FrontPortTemplateTypeValueLsh captures enum value "lsh" 693 FrontPortTemplateTypeValueLsh string = "lsh" 694 695 // FrontPortTemplateTypeValueLshDashApc captures enum value "lsh-apc" 696 FrontPortTemplateTypeValueLshDashApc string = "lsh-apc" 697 698 // FrontPortTemplateTypeValueMpo captures enum value "mpo" 699 FrontPortTemplateTypeValueMpo string = "mpo" 700 701 // FrontPortTemplateTypeValueMtrj captures enum value "mtrj" 702 FrontPortTemplateTypeValueMtrj string = "mtrj" 703 704 // FrontPortTemplateTypeValueSc captures enum value "sc" 705 FrontPortTemplateTypeValueSc string = "sc" 706 707 // FrontPortTemplateTypeValueScDashApc captures enum value "sc-apc" 708 FrontPortTemplateTypeValueScDashApc string = "sc-apc" 709 710 // FrontPortTemplateTypeValueSt captures enum value "st" 711 FrontPortTemplateTypeValueSt string = "st" 712 713 // FrontPortTemplateTypeValueCs captures enum value "cs" 714 FrontPortTemplateTypeValueCs string = "cs" 715 716 // FrontPortTemplateTypeValueSn captures enum value "sn" 717 FrontPortTemplateTypeValueSn string = "sn" 718 719 // FrontPortTemplateTypeValueSplice captures enum value "splice" 720 FrontPortTemplateTypeValueSplice string = "splice" 721 ) 722 723 // prop value enum 724 func (m *FrontPortTemplateType) validateValueEnum(path, location string, value string) error { 725 if err := validate.EnumCase(path, location, value, frontPortTemplateTypeTypeValuePropEnum, true); err != nil { 726 return err 727 } 728 return nil 729 } 730 731 func (m *FrontPortTemplateType) validateValue(formats strfmt.Registry) error { 732 733 if err := validate.Required("type"+"."+"value", "body", m.Value); err != nil { 734 return err 735 } 736 737 // value enum 738 if err := m.validateValueEnum("type"+"."+"value", "body", *m.Value); err != nil { 739 return err 740 } 741 742 return nil 743 } 744 745 // ContextValidate validates this front port template type based on context it is used 746 func (m *FrontPortTemplateType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 747 return nil 748 } 749 750 // MarshalBinary interface implementation 751 func (m *FrontPortTemplateType) MarshalBinary() ([]byte, error) { 752 if m == nil { 753 return nil, nil 754 } 755 return swag.WriteJSON(m) 756 } 757 758 // UnmarshalBinary interface implementation 759 func (m *FrontPortTemplateType) UnmarshalBinary(b []byte) error { 760 var res FrontPortTemplateType 761 if err := swag.ReadJSON(b, &res); err != nil { 762 return err 763 } 764 *m = res 765 return nil 766 }