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