blob: e409f494d8e2e20463ed24a832c75ac700526612 [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// WritableRackGroup writable rack group
31// swagger:model WritableRackGroup
32type WritableRackGroup struct {
33
34 // ID
35 // Read Only: true
36 ID int64 `json:"id,omitempty"`
37
38 // Name
39 // Required: true
40 // Max Length: 50
41 Name *string `json:"name"`
42
43 // Site
44 // Required: true
45 Site *int64 `json:"site"`
46
47 // Slug
48 // Required: true
49 // Max Length: 50
50 // Pattern: ^[-a-zA-Z0-9_]+$
51 Slug *string `json:"slug"`
52}
53
54// Validate validates this writable rack group
55func (m *WritableRackGroup) Validate(formats strfmt.Registry) error {
56 var res []error
57
58 if err := m.validateName(formats); err != nil {
59 // prop
60 res = append(res, err)
61 }
62
63 if err := m.validateSite(formats); err != nil {
64 // prop
65 res = append(res, err)
66 }
67
68 if err := m.validateSlug(formats); err != nil {
69 // prop
70 res = append(res, err)
71 }
72
73 if len(res) > 0 {
74 return errors.CompositeValidationError(res...)
75 }
76 return nil
77}
78
79func (m *WritableRackGroup) validateName(formats strfmt.Registry) error {
80
81 if err := validate.Required("name", "body", m.Name); err != nil {
82 return err
83 }
84
85 if err := validate.MaxLength("name", "body", string(*m.Name), 50); err != nil {
86 return err
87 }
88
89 return nil
90}
91
92func (m *WritableRackGroup) validateSite(formats strfmt.Registry) error {
93
94 if err := validate.Required("site", "body", m.Site); err != nil {
95 return err
96 }
97
98 return nil
99}
100
101func (m *WritableRackGroup) validateSlug(formats strfmt.Registry) error {
102
103 if err := validate.Required("slug", "body", m.Slug); err != nil {
104 return err
105 }
106
107 if err := validate.MaxLength("slug", "body", string(*m.Slug), 50); err != nil {
108 return err
109 }
110
111 if err := validate.Pattern("slug", "body", string(*m.Slug), `^[-a-zA-Z0-9_]+$`); err != nil {
112 return err
113 }
114
115 return nil
116}
117
118// MarshalBinary interface implementation
119func (m *WritableRackGroup) MarshalBinary() ([]byte, error) {
120 if m == nil {
121 return nil, nil
122 }
123 return swag.WriteJSON(m)
124}
125
126// UnmarshalBinary interface implementation
127func (m *WritableRackGroup) UnmarshalBinary(b []byte) error {
128 var res WritableRackGroup
129 if err := swag.ReadJSON(b, &res); err != nil {
130 return err
131 }
132 *m = res
133 return nil
134}