Serge Bazanski | cc25bdf | 2018-10-25 14:02:58 +0200 | [diff] [blame] | 1 | // Code generated by go-swagger; DO NOT EDIT. |
| 2 | |
| 3 | // Copyright 2018 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 | package models |
| 18 | |
| 19 | // This file was generated by the swagger tool. |
| 20 | // Editing this file might prove futile when you re-run the swagger generate command |
| 21 | |
| 22 | import ( |
| 23 | strfmt "github.com/go-openapi/strfmt" |
| 24 | |
| 25 | "github.com/go-openapi/errors" |
| 26 | "github.com/go-openapi/swag" |
| 27 | "github.com/go-openapi/validate" |
| 28 | ) |
| 29 | |
| 30 | // InterfaceVLAN Untagged vlan |
| 31 | // swagger:model InterfaceVLAN |
| 32 | type InterfaceVLAN struct { |
| 33 | |
| 34 | // Display name |
| 35 | // Read Only: true |
| 36 | DisplayName string `json:"display_name,omitempty"` |
| 37 | |
| 38 | // ID |
| 39 | // Read Only: true |
| 40 | ID int64 `json:"id,omitempty"` |
| 41 | |
| 42 | // Name |
| 43 | // Required: true |
| 44 | // Max Length: 64 |
| 45 | Name *string `json:"name"` |
| 46 | |
| 47 | // Url |
| 48 | // Read Only: true |
| 49 | URL strfmt.URI `json:"url,omitempty"` |
| 50 | |
| 51 | // ID |
| 52 | // Required: true |
| 53 | // Maximum: 4094 |
| 54 | // Minimum: 1 |
| 55 | Vid *int64 `json:"vid"` |
| 56 | } |
| 57 | |
| 58 | // Validate validates this interface v l a n |
| 59 | func (m *InterfaceVLAN) Validate(formats strfmt.Registry) error { |
| 60 | var res []error |
| 61 | |
| 62 | if err := m.validateName(formats); err != nil { |
| 63 | // prop |
| 64 | res = append(res, err) |
| 65 | } |
| 66 | |
| 67 | if err := m.validateVid(formats); err != nil { |
| 68 | // prop |
| 69 | res = append(res, err) |
| 70 | } |
| 71 | |
| 72 | if len(res) > 0 { |
| 73 | return errors.CompositeValidationError(res...) |
| 74 | } |
| 75 | return nil |
| 76 | } |
| 77 | |
| 78 | func (m *InterfaceVLAN) validateName(formats strfmt.Registry) error { |
| 79 | |
| 80 | if err := validate.Required("name", "body", m.Name); err != nil { |
| 81 | return err |
| 82 | } |
| 83 | |
| 84 | if err := validate.MaxLength("name", "body", string(*m.Name), 64); err != nil { |
| 85 | return err |
| 86 | } |
| 87 | |
| 88 | return nil |
| 89 | } |
| 90 | |
| 91 | func (m *InterfaceVLAN) validateVid(formats strfmt.Registry) error { |
| 92 | |
| 93 | if err := validate.Required("vid", "body", m.Vid); err != nil { |
| 94 | return err |
| 95 | } |
| 96 | |
| 97 | if err := validate.MinimumInt("vid", "body", int64(*m.Vid), 1, false); err != nil { |
| 98 | return err |
| 99 | } |
| 100 | |
| 101 | if err := validate.MaximumInt("vid", "body", int64(*m.Vid), 4094, false); err != nil { |
| 102 | return err |
| 103 | } |
| 104 | |
| 105 | return nil |
| 106 | } |
| 107 | |
| 108 | // MarshalBinary interface implementation |
| 109 | func (m *InterfaceVLAN) MarshalBinary() ([]byte, error) { |
| 110 | if m == nil { |
| 111 | return nil, nil |
| 112 | } |
| 113 | return swag.WriteJSON(m) |
| 114 | } |
| 115 | |
| 116 | // UnmarshalBinary interface implementation |
| 117 | func (m *InterfaceVLAN) UnmarshalBinary(b []byte) error { |
| 118 | var res InterfaceVLAN |
| 119 | if err := swag.ReadJSON(b, &res); err != nil { |
| 120 | return err |
| 121 | } |
| 122 | *m = res |
| 123 | return nil |
| 124 | } |