blob: e1caaeeac6e3ad9c023f3cf0163810461404920d [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// WritableDeviceBay writable device bay
31// swagger:model WritableDeviceBay
32type WritableDeviceBay struct {
33
34 // Device
35 // Required: true
36 Device *int64 `json:"device"`
37
38 // ID
39 // Read Only: true
40 ID int64 `json:"id,omitempty"`
41
42 // Installed device
43 InstalledDevice int64 `json:"installed_device,omitempty"`
44
45 // Name
46 // Required: true
47 // Max Length: 50
48 Name *string `json:"name"`
49}
50
51// Validate validates this writable device bay
52func (m *WritableDeviceBay) Validate(formats strfmt.Registry) error {
53 var res []error
54
55 if err := m.validateDevice(formats); err != nil {
56 // prop
57 res = append(res, err)
58 }
59
60 if err := m.validateName(formats); err != nil {
61 // prop
62 res = append(res, err)
63 }
64
65 if len(res) > 0 {
66 return errors.CompositeValidationError(res...)
67 }
68 return nil
69}
70
71func (m *WritableDeviceBay) validateDevice(formats strfmt.Registry) error {
72
73 if err := validate.Required("device", "body", m.Device); err != nil {
74 return err
75 }
76
77 return nil
78}
79
80func (m *WritableDeviceBay) validateName(formats strfmt.Registry) error {
81
82 if err := validate.Required("name", "body", m.Name); err != nil {
83 return err
84 }
85
86 if err := validate.MaxLength("name", "body", string(*m.Name), 50); err != nil {
87 return err
88 }
89
90 return nil
91}
92
93// MarshalBinary interface implementation
94func (m *WritableDeviceBay) MarshalBinary() ([]byte, error) {
95 if m == nil {
96 return nil, nil
97 }
98 return swag.WriteJSON(m)
99}
100
101// UnmarshalBinary interface implementation
102func (m *WritableDeviceBay) UnmarshalBinary(b []byte) error {
103 var res WritableDeviceBay
104 if err := swag.ReadJSON(b, &res); err != nil {
105 return err
106 }
107 *m = res
108 return nil
109}