blob: 08c5b42ed5eac852a66f0261f0e19873e4eb9f08 [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// NestedRack Rack
31// swagger:model NestedRack
32type NestedRack 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: 50
45 Name *string `json:"name"`
46
47 // Url
48 // Read Only: true
49 URL strfmt.URI `json:"url,omitempty"`
50}
51
52// Validate validates this nested rack
53func (m *NestedRack) Validate(formats strfmt.Registry) error {
54 var res []error
55
56 if err := m.validateName(formats); err != nil {
57 // prop
58 res = append(res, err)
59 }
60
61 if len(res) > 0 {
62 return errors.CompositeValidationError(res...)
63 }
64 return nil
65}
66
67func (m *NestedRack) validateName(formats strfmt.Registry) error {
68
69 if err := validate.Required("name", "body", m.Name); err != nil {
70 return err
71 }
72
73 if err := validate.MaxLength("name", "body", string(*m.Name), 50); err != nil {
74 return err
75 }
76
77 return nil
78}
79
80// MarshalBinary interface implementation
81func (m *NestedRack) MarshalBinary() ([]byte, error) {
82 if m == nil {
83 return nil, nil
84 }
85 return swag.WriteJSON(m)
86}
87
88// UnmarshalBinary interface implementation
89func (m *NestedRack) UnmarshalBinary(b []byte) error {
90 var res NestedRack
91 if err := swag.ReadJSON(b, &res); err != nil {
92 return err
93 }
94 *m = res
95 return nil
96}