blob: e20436172e5595e7fc4b0e00a5e0c5ef047d9a70 [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// WritableVirtualChassis writable virtual chassis
31// swagger:model WritableVirtualChassis
32type WritableVirtualChassis 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 *int64 `json:"master"`
45}
46
47// Validate validates this writable virtual chassis
48func (m *WritableVirtualChassis) 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 *WritableVirtualChassis) 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 *WritableVirtualChassis) validateMaster(formats strfmt.Registry) error {
81
82 if err := validate.Required("master", "body", m.Master); err != nil {
83 return err
84 }
85
86 return nil
87}
88
89// MarshalBinary interface implementation
90func (m *WritableVirtualChassis) MarshalBinary() ([]byte, error) {
91 if m == nil {
92 return nil, nil
93 }
94 return swag.WriteJSON(m)
95}
96
97// UnmarshalBinary interface implementation
98func (m *WritableVirtualChassis) UnmarshalBinary(b []byte) error {
99 var res WritableVirtualChassis
100 if err := swag.ReadJSON(b, &res); err != nil {
101 return err
102 }
103 *m = res
104 return nil
105}