blob: d0a92cc47d5ba15a681998e4e8e06b06c82a7a82 [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 "encoding/json"
24
25 strfmt "github.com/go-openapi/strfmt"
26
27 "github.com/go-openapi/errors"
28 "github.com/go-openapi/swag"
29 "github.com/go-openapi/validate"
30)
31
32// WritableCircuit writable circuit
33// swagger:model WritableCircuit
34type WritableCircuit struct {
35
36 // Circuit ID
37 // Required: true
38 // Max Length: 50
39 Cid *string `json:"cid"`
40
41 // Comments
42 Comments string `json:"comments,omitempty"`
43
44 // Commit rate (Kbps)
45 // Maximum: 2.147483647e+09
46 // Minimum: 0
47 CommitRate *int64 `json:"commit_rate,omitempty"`
48
49 // Created
50 // Read Only: true
51 Created strfmt.Date `json:"created,omitempty"`
52
53 // Custom fields
54 CustomFields interface{} `json:"custom_fields,omitempty"`
55
56 // Description
57 // Max Length: 100
58 Description string `json:"description,omitempty"`
59
60 // ID
61 // Read Only: true
62 ID int64 `json:"id,omitempty"`
63
64 // Date installed
65 InstallDate strfmt.Date `json:"install_date,omitempty"`
66
67 // Last updated
68 // Read Only: true
69 LastUpdated strfmt.DateTime `json:"last_updated,omitempty"`
70
71 // Provider
72 // Required: true
73 Provider *int64 `json:"provider"`
74
75 // Status
76 Status int64 `json:"status,omitempty"`
77
78 // Tenant
79 Tenant int64 `json:"tenant,omitempty"`
80
81 // Type
82 // Required: true
83 Type *int64 `json:"type"`
84}
85
86// Validate validates this writable circuit
87func (m *WritableCircuit) Validate(formats strfmt.Registry) error {
88 var res []error
89
90 if err := m.validateCid(formats); err != nil {
91 // prop
92 res = append(res, err)
93 }
94
95 if err := m.validateCommitRate(formats); err != nil {
96 // prop
97 res = append(res, err)
98 }
99
100 if err := m.validateDescription(formats); err != nil {
101 // prop
102 res = append(res, err)
103 }
104
105 if err := m.validateProvider(formats); err != nil {
106 // prop
107 res = append(res, err)
108 }
109
110 if err := m.validateStatus(formats); err != nil {
111 // prop
112 res = append(res, err)
113 }
114
115 if err := m.validateType(formats); err != nil {
116 // prop
117 res = append(res, err)
118 }
119
120 if len(res) > 0 {
121 return errors.CompositeValidationError(res...)
122 }
123 return nil
124}
125
126func (m *WritableCircuit) validateCid(formats strfmt.Registry) error {
127
128 if err := validate.Required("cid", "body", m.Cid); err != nil {
129 return err
130 }
131
132 if err := validate.MaxLength("cid", "body", string(*m.Cid), 50); err != nil {
133 return err
134 }
135
136 return nil
137}
138
139func (m *WritableCircuit) validateCommitRate(formats strfmt.Registry) error {
140
141 if swag.IsZero(m.CommitRate) { // not required
142 return nil
143 }
144
145 if err := validate.MinimumInt("commit_rate", "body", int64(*m.CommitRate), 0, false); err != nil {
146 return err
147 }
148
149 if err := validate.MaximumInt("commit_rate", "body", int64(*m.CommitRate), 2.147483647e+09, false); err != nil {
150 return err
151 }
152
153 return nil
154}
155
156func (m *WritableCircuit) validateDescription(formats strfmt.Registry) error {
157
158 if swag.IsZero(m.Description) { // not required
159 return nil
160 }
161
162 if err := validate.MaxLength("description", "body", string(m.Description), 100); err != nil {
163 return err
164 }
165
166 return nil
167}
168
169func (m *WritableCircuit) validateProvider(formats strfmt.Registry) error {
170
171 if err := validate.Required("provider", "body", m.Provider); err != nil {
172 return err
173 }
174
175 return nil
176}
177
178var writableCircuitTypeStatusPropEnum []interface{}
179
180func init() {
181 var res []int64
182 if err := json.Unmarshal([]byte(`[2,3,1,4,0,5]`), &res); err != nil {
183 panic(err)
184 }
185 for _, v := range res {
186 writableCircuitTypeStatusPropEnum = append(writableCircuitTypeStatusPropEnum, v)
187 }
188}
189
190// prop value enum
191func (m *WritableCircuit) validateStatusEnum(path, location string, value int64) error {
192 if err := validate.Enum(path, location, value, writableCircuitTypeStatusPropEnum); err != nil {
193 return err
194 }
195 return nil
196}
197
198func (m *WritableCircuit) validateStatus(formats strfmt.Registry) error {
199
200 if swag.IsZero(m.Status) { // not required
201 return nil
202 }
203
204 // value enum
205 if err := m.validateStatusEnum("status", "body", m.Status); err != nil {
206 return err
207 }
208
209 return nil
210}
211
212func (m *WritableCircuit) validateType(formats strfmt.Registry) error {
213
214 if err := validate.Required("type", "body", m.Type); err != nil {
215 return err
216 }
217
218 return nil
219}
220
221// MarshalBinary interface implementation
222func (m *WritableCircuit) MarshalBinary() ([]byte, error) {
223 if m == nil {
224 return nil, nil
225 }
226 return swag.WriteJSON(m)
227}
228
229// UnmarshalBinary interface implementation
230func (m *WritableCircuit) UnmarshalBinary(b []byte) error {
231 var res WritableCircuit
232 if err := swag.ReadJSON(b, &res); err != nil {
233 return err
234 }
235 *m = res
236 return nil
237}