blob: be46fe99e65088112f36b1d809e44a260832f5a2 [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// VirtualChassis virtual chassis
31// swagger:model VirtualChassis
32type VirtualChassis struct {
33
34 // Domain
35 // Max Length: 30
36 Domain string `json:"domain,omitempty"`
37
38 // ID
39 // Read Only: true
40 ID int64 `json:"id,omitempty"`
41
42 // master
43 // Required: true
44 Master *NestedDevice `json:"master"`
45}
46
47// Validate validates this virtual chassis
48func (m *VirtualChassis) Validate(formats strfmt.Registry) error {
49 var res []error
50
51 if err := m.validateDomain(formats); err != nil {
52 // prop
53 res = append(res, err)
54 }
55
56 if err := m.validateMaster(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 *VirtualChassis) validateDomain(formats strfmt.Registry) error {
68
69 if swag.IsZero(m.Domain) { // not required
70 return nil
71 }
72
73 if err := validate.MaxLength("domain", "body", string(m.Domain), 30); err != nil {
74 return err
75 }
76
77 return nil
78}
79
80func (m *VirtualChassis) validateMaster(formats strfmt.Registry) error {
81
82 if err := validate.Required("master", "body", m.Master); err != nil {
83 return err
84 }
85
86 if m.Master != nil {
87
88 if err := m.Master.Validate(formats); err != nil {
89 if ve, ok := err.(*errors.Validation); ok {
90 return ve.ValidateName("master")
91 }
92 return err
93 }
94 }
95
96 return nil
97}
98
99// MarshalBinary interface implementation
100func (m *VirtualChassis) MarshalBinary() ([]byte, error) {
101 if m == nil {
102 return nil, nil
103 }
104 return swag.WriteJSON(m)
105}
106
107// UnmarshalBinary interface implementation
108func (m *VirtualChassis) UnmarshalBinary(b []byte) error {
109 var res VirtualChassis
110 if err := swag.ReadJSON(b, &res); err != nil {
111 return err
112 }
113 *m = res
114 return nil
115}