blob: 882b01269063678cc8771a5dd667065409d7ca77 [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// UserAction user action
31// swagger:model UserAction
32type UserAction struct {
33
34 // action
35 // Required: true
36 Action *UserActionAction `json:"action"`
37
38 // ID
39 // Read Only: true
40 ID int64 `json:"id,omitempty"`
41
42 // Message
43 Message string `json:"message,omitempty"`
44
45 // Time
46 // Read Only: true
47 Time strfmt.DateTime `json:"time,omitempty"`
48
49 // user
50 // Required: true
51 User *NestedUser `json:"user"`
52}
53
54// Validate validates this user action
55func (m *UserAction) Validate(formats strfmt.Registry) error {
56 var res []error
57
58 if err := m.validateAction(formats); err != nil {
59 // prop
60 res = append(res, err)
61 }
62
63 if err := m.validateUser(formats); err != nil {
64 // prop
65 res = append(res, err)
66 }
67
68 if len(res) > 0 {
69 return errors.CompositeValidationError(res...)
70 }
71 return nil
72}
73
74func (m *UserAction) validateAction(formats strfmt.Registry) error {
75
76 if err := validate.Required("action", "body", m.Action); err != nil {
77 return err
78 }
79
80 if m.Action != nil {
81
82 if err := m.Action.Validate(formats); err != nil {
83 if ve, ok := err.(*errors.Validation); ok {
84 return ve.ValidateName("action")
85 }
86 return err
87 }
88 }
89
90 return nil
91}
92
93func (m *UserAction) validateUser(formats strfmt.Registry) error {
94
95 if err := validate.Required("user", "body", m.User); err != nil {
96 return err
97 }
98
99 if m.User != nil {
100
101 if err := m.User.Validate(formats); err != nil {
102 if ve, ok := err.(*errors.Validation); ok {
103 return ve.ValidateName("user")
104 }
105 return err
106 }
107 }
108
109 return nil
110}
111
112// MarshalBinary interface implementation
113func (m *UserAction) MarshalBinary() ([]byte, error) {
114 if m == nil {
115 return nil, nil
116 }
117 return swag.WriteJSON(m)
118}
119
120// UnmarshalBinary interface implementation
121func (m *UserAction) UnmarshalBinary(b []byte) error {
122 var res UserAction
123 if err := swag.ReadJSON(b, &res); err != nil {
124 return err
125 }
126 *m = res
127 return nil
128}