blob: d172ea05048dfa5d6bcc6836617c5c7aa1b784f6 [file] [log] [blame]
Serge Bazanskicc25bdf2018-10-25 14:02:58 +02001// 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
17package 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
22import (
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// VRF v r f
31// swagger:model VRF
32type VRF struct {
33
34 // Created
35 // Read Only: true
36 Created strfmt.Date `json:"created,omitempty"`
37
38 // Custom fields
39 CustomFields interface{} `json:"custom_fields,omitempty"`
40
41 // Description
42 // Max Length: 100
43 Description string `json:"description,omitempty"`
44
45 // Display name
46 // Read Only: true
47 DisplayName string `json:"display_name,omitempty"`
48
49 // Enforce unique space
50 //
51 // Prevent duplicate prefixes/IP addresses within this VRF
52 EnforceUnique bool `json:"enforce_unique,omitempty"`
53
54 // ID
55 // Read Only: true
56 ID int64 `json:"id,omitempty"`
57
58 // Last updated
59 // Read Only: true
60 LastUpdated strfmt.DateTime `json:"last_updated,omitempty"`
61
62 // Name
63 // Required: true
64 // Max Length: 50
65 Name *string `json:"name"`
66
67 // Route distinguisher
68 // Required: true
69 // Max Length: 21
70 Rd *string `json:"rd"`
71
72 // tenant
73 // Required: true
74 Tenant *NestedTenant `json:"tenant"`
75}
76
77// Validate validates this v r f
78func (m *VRF) Validate(formats strfmt.Registry) error {
79 var res []error
80
81 if err := m.validateDescription(formats); err != nil {
82 // prop
83 res = append(res, err)
84 }
85
86 if err := m.validateName(formats); err != nil {
87 // prop
88 res = append(res, err)
89 }
90
91 if err := m.validateRd(formats); err != nil {
92 // prop
93 res = append(res, err)
94 }
95
96 if err := m.validateTenant(formats); err != nil {
97 // prop
98 res = append(res, err)
99 }
100
101 if len(res) > 0 {
102 return errors.CompositeValidationError(res...)
103 }
104 return nil
105}
106
107func (m *VRF) validateDescription(formats strfmt.Registry) error {
108
109 if swag.IsZero(m.Description) { // not required
110 return nil
111 }
112
113 if err := validate.MaxLength("description", "body", string(m.Description), 100); err != nil {
114 return err
115 }
116
117 return nil
118}
119
120func (m *VRF) validateName(formats strfmt.Registry) error {
121
122 if err := validate.Required("name", "body", m.Name); err != nil {
123 return err
124 }
125
126 if err := validate.MaxLength("name", "body", string(*m.Name), 50); err != nil {
127 return err
128 }
129
130 return nil
131}
132
133func (m *VRF) validateRd(formats strfmt.Registry) error {
134
135 if err := validate.Required("rd", "body", m.Rd); err != nil {
136 return err
137 }
138
139 if err := validate.MaxLength("rd", "body", string(*m.Rd), 21); err != nil {
140 return err
141 }
142
143 return nil
144}
145
146func (m *VRF) validateTenant(formats strfmt.Registry) error {
147
148 if err := validate.Required("tenant", "body", m.Tenant); err != nil {
149 return err
150 }
151
152 if m.Tenant != nil {
153
154 if err := m.Tenant.Validate(formats); err != nil {
155 if ve, ok := err.(*errors.Validation); ok {
156 return ve.ValidateName("tenant")
157 }
158 return err
159 }
160 }
161
162 return nil
163}
164
165// MarshalBinary interface implementation
166func (m *VRF) MarshalBinary() ([]byte, error) {
167 if m == nil {
168 return nil, nil
169 }
170 return swag.WriteJSON(m)
171}
172
173// UnmarshalBinary interface implementation
174func (m *VRF) UnmarshalBinary(b []byte) error {
175 var res VRF
176 if err := swag.ReadJSON(b, &res); err != nil {
177 return err
178 }
179 *m = res
180 return nil
181}