blob: c65052008ba4c63b69d6946a32e54d20b4622ce2 [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 "encoding/json"
24
25 strfmt "github.com/go-openapi/strfmt"
26
27 "github.com/go-openapi/errors"
28 "github.com/go-openapi/swag"
29 "github.com/go-openapi/validate"
30)
31
32// WritableInterfaceConnection writable interface connection
33// swagger:model WritableInterfaceConnection
34type WritableInterfaceConnection struct {
35
36 // Status
37 ConnectionStatus bool `json:"connection_status,omitempty"`
38
39 // ID
40 // Read Only: true
41 ID int64 `json:"id,omitempty"`
42
43 // Interface a
44 // Required: true
45 InterfaceA *int64 `json:"interface_a"`
46
47 // Interface b
48 // Required: true
49 InterfaceB *int64 `json:"interface_b"`
50}
51
52// Validate validates this writable interface connection
53func (m *WritableInterfaceConnection) Validate(formats strfmt.Registry) error {
54 var res []error
55
56 if err := m.validateConnectionStatus(formats); err != nil {
57 // prop
58 res = append(res, err)
59 }
60
61 if err := m.validateInterfaceA(formats); err != nil {
62 // prop
63 res = append(res, err)
64 }
65
66 if err := m.validateInterfaceB(formats); err != nil {
67 // prop
68 res = append(res, err)
69 }
70
71 if len(res) > 0 {
72 return errors.CompositeValidationError(res...)
73 }
74 return nil
75}
76
77var writableInterfaceConnectionTypeConnectionStatusPropEnum []interface{}
78
79func init() {
80 var res []bool
81 if err := json.Unmarshal([]byte(`[false,true]`), &res); err != nil {
82 panic(err)
83 }
84 for _, v := range res {
85 writableInterfaceConnectionTypeConnectionStatusPropEnum = append(writableInterfaceConnectionTypeConnectionStatusPropEnum, v)
86 }
87}
88
89// prop value enum
90func (m *WritableInterfaceConnection) validateConnectionStatusEnum(path, location string, value bool) error {
91 if err := validate.Enum(path, location, value, writableInterfaceConnectionTypeConnectionStatusPropEnum); err != nil {
92 return err
93 }
94 return nil
95}
96
97func (m *WritableInterfaceConnection) validateConnectionStatus(formats strfmt.Registry) error {
98
99 if swag.IsZero(m.ConnectionStatus) { // not required
100 return nil
101 }
102
103 // value enum
104 if err := m.validateConnectionStatusEnum("connection_status", "body", m.ConnectionStatus); err != nil {
105 return err
106 }
107
108 return nil
109}
110
111func (m *WritableInterfaceConnection) validateInterfaceA(formats strfmt.Registry) error {
112
113 if err := validate.Required("interface_a", "body", m.InterfaceA); err != nil {
114 return err
115 }
116
117 return nil
118}
119
120func (m *WritableInterfaceConnection) validateInterfaceB(formats strfmt.Registry) error {
121
122 if err := validate.Required("interface_b", "body", m.InterfaceB); err != nil {
123 return err
124 }
125
126 return nil
127}
128
129// MarshalBinary interface implementation
130func (m *WritableInterfaceConnection) MarshalBinary() ([]byte, error) {
131 if m == nil {
132 return nil, nil
133 }
134 return swag.WriteJSON(m)
135}
136
137// UnmarshalBinary interface implementation
138func (m *WritableInterfaceConnection) UnmarshalBinary(b []byte) error {
139 var res WritableInterfaceConnection
140 if err := swag.ReadJSON(b, &res); err != nil {
141 return err
142 }
143 *m = res
144 return nil
145}