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 | // InterfaceFormFactor Form factor |
| 31 | // swagger:model interfaceFormFactor |
| 32 | type InterfaceFormFactor struct { |
| 33 | |
| 34 | // label |
| 35 | // Required: true |
| 36 | Label *string `json:"label"` |
| 37 | |
| 38 | // value |
| 39 | // Required: true |
| 40 | Value *int64 `json:"value"` |
| 41 | } |
| 42 | |
| 43 | // Validate validates this interface form factor |
| 44 | func (m *InterfaceFormFactor) Validate(formats strfmt.Registry) error { |
| 45 | var res []error |
| 46 | |
| 47 | if err := m.validateLabel(formats); err != nil { |
| 48 | // prop |
| 49 | res = append(res, err) |
| 50 | } |
| 51 | |
| 52 | if err := m.validateValue(formats); err != nil { |
| 53 | // prop |
| 54 | res = append(res, err) |
| 55 | } |
| 56 | |
| 57 | if len(res) > 0 { |
| 58 | return errors.CompositeValidationError(res...) |
| 59 | } |
| 60 | return nil |
| 61 | } |
| 62 | |
| 63 | func (m *InterfaceFormFactor) validateLabel(formats strfmt.Registry) error { |
| 64 | |
| 65 | if err := validate.Required("label", "body", m.Label); err != nil { |
| 66 | return err |
| 67 | } |
| 68 | |
| 69 | return nil |
| 70 | } |
| 71 | |
| 72 | func (m *InterfaceFormFactor) validateValue(formats strfmt.Registry) error { |
| 73 | |
| 74 | if err := validate.Required("value", "body", m.Value); err != nil { |
| 75 | return err |
| 76 | } |
| 77 | |
| 78 | return nil |
| 79 | } |
| 80 | |
| 81 | // MarshalBinary interface implementation |
| 82 | func (m *InterfaceFormFactor) MarshalBinary() ([]byte, error) { |
| 83 | if m == nil { |
| 84 | return nil, nil |
| 85 | } |
| 86 | return swag.WriteJSON(m) |
| 87 | } |
| 88 | |
| 89 | // UnmarshalBinary interface implementation |
| 90 | func (m *InterfaceFormFactor) UnmarshalBinary(b []byte) error { |
| 91 | var res InterfaceFormFactor |
| 92 | if err := swag.ReadJSON(b, &res); err != nil { |
| 93 | return err |
| 94 | } |
| 95 | *m = res |
| 96 | return nil |
| 97 | } |