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