blob: 7f2de135dcc116e52e09d8696e99a35f391a7766 [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// WritableAggregate writable aggregate
31// swagger:model WritableAggregate
32type WritableAggregate struct {
33
34 // Created
35 // Read Only: true
36 Created strfmt.Date `json:"created,omitempty"`
37
38 // Custom fields
39 CustomFields interface{} `json:"custom_fields,omitempty"`
40
41 // Date added
42 DateAdded strfmt.Date `json:"date_added,omitempty"`
43
44 // Description
45 // Max Length: 100
46 Description string `json:"description,omitempty"`
47
48 // ID
49 // Read Only: true
50 ID int64 `json:"id,omitempty"`
51
52 // Last updated
53 // Read Only: true
54 LastUpdated strfmt.DateTime `json:"last_updated,omitempty"`
55
56 // Prefix
57 // Required: true
58 Prefix *string `json:"prefix"`
59
60 // RIR
61 // Required: true
62 Rir *int64 `json:"rir"`
63}
64
65// Validate validates this writable aggregate
66func (m *WritableAggregate) Validate(formats strfmt.Registry) error {
67 var res []error
68
69 if err := m.validateDescription(formats); err != nil {
70 // prop
71 res = append(res, err)
72 }
73
74 if err := m.validatePrefix(formats); err != nil {
75 // prop
76 res = append(res, err)
77 }
78
79 if err := m.validateRir(formats); err != nil {
80 // prop
81 res = append(res, err)
82 }
83
84 if len(res) > 0 {
85 return errors.CompositeValidationError(res...)
86 }
87 return nil
88}
89
90func (m *WritableAggregate) validateDescription(formats strfmt.Registry) error {
91
92 if swag.IsZero(m.Description) { // not required
93 return nil
94 }
95
96 if err := validate.MaxLength("description", "body", string(m.Description), 100); err != nil {
97 return err
98 }
99
100 return nil
101}
102
103func (m *WritableAggregate) validatePrefix(formats strfmt.Registry) error {
104
105 if err := validate.Required("prefix", "body", m.Prefix); err != nil {
106 return err
107 }
108
109 return nil
110}
111
112func (m *WritableAggregate) validateRir(formats strfmt.Registry) error {
113
114 if err := validate.Required("rir", "body", m.Rir); err != nil {
115 return err
116 }
117
118 return nil
119}
120
121// MarshalBinary interface implementation
122func (m *WritableAggregate) MarshalBinary() ([]byte, error) {
123 if m == nil {
124 return nil, nil
125 }
126 return swag.WriteJSON(m)
127}
128
129// UnmarshalBinary interface implementation
130func (m *WritableAggregate) UnmarshalBinary(b []byte) error {
131 var res WritableAggregate
132 if err := swag.ReadJSON(b, &res); err != nil {
133 return err
134 }
135 *m = res
136 return nil
137}