blob: 0068bfb269887478b2353002d64d68fac4beffcd [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// NestedVirtualMachine Virtual machine
31// swagger:model NestedVirtualMachine
32type NestedVirtualMachine struct {
33
34 // ID
35 // Read Only: true
36 ID int64 `json:"id,omitempty"`
37
38 // Name
39 // Required: true
40 // Max Length: 64
41 Name *string `json:"name"`
42
43 // Url
44 // Read Only: true
45 URL strfmt.URI `json:"url,omitempty"`
46}
47
48// Validate validates this nested virtual machine
49func (m *NestedVirtualMachine) Validate(formats strfmt.Registry) error {
50 var res []error
51
52 if err := m.validateName(formats); err != nil {
53 // prop
54 res = append(res, err)
55 }
56
57 if len(res) > 0 {
58 return errors.CompositeValidationError(res...)
59 }
60 return nil
61}
62
63func (m *NestedVirtualMachine) validateName(formats strfmt.Registry) error {
64
65 if err := validate.Required("name", "body", m.Name); err != nil {
66 return err
67 }
68
69 if err := validate.MaxLength("name", "body", string(*m.Name), 64); err != nil {
70 return err
71 }
72
73 return nil
74}
75
76// MarshalBinary interface implementation
77func (m *NestedVirtualMachine) MarshalBinary() ([]byte, error) {
78 if m == nil {
79 return nil, nil
80 }
81 return swag.WriteJSON(m)
82}
83
84// UnmarshalBinary interface implementation
85func (m *NestedVirtualMachine) UnmarshalBinary(b []byte) error {
86 var res NestedVirtualMachine
87 if err := swag.ReadJSON(b, &res); err != nil {
88 return err
89 }
90 *m = res
91 return nil
92}