REST API: use byte array for E2SM event trigger
[ric-plt/xapp-frame.git] / pkg / models / action_to_be_setup.go
1 // Code generated by go-swagger; DO NOT EDIT.
2
3 package models
4
5 // This file was generated by the swagger tool.
6 // Editing this file might prove futile when you re-run the swagger generate command
7
8 import (
9         "encoding/json"
10
11         "github.com/go-openapi/errors"
12         "github.com/go-openapi/strfmt"
13         "github.com/go-openapi/swag"
14         "github.com/go-openapi/validate"
15 )
16
17 // ActionToBeSetup action to be setup
18 //
19 // swagger:model ActionToBeSetup
20 type ActionToBeSetup struct {
21
22         // action definition
23         ActionDefinition ActionDefinition `json:"ActionDefinition,omitempty"`
24
25         // action ID
26         // Required: true
27         // Maximum: 255
28         // Minimum: 0
29         ActionID *int64 `json:"ActionID"`
30
31         // action type
32         // Required: true
33         // Enum: [insert policy report]
34         ActionType *string `json:"ActionType"`
35
36         // subsequent action
37         SubsequentAction *SubsequentAction `json:"SubsequentAction,omitempty"`
38 }
39
40 // Validate validates this action to be setup
41 func (m *ActionToBeSetup) Validate(formats strfmt.Registry) error {
42         var res []error
43
44         if err := m.validateActionDefinition(formats); err != nil {
45                 res = append(res, err)
46         }
47
48         if err := m.validateActionID(formats); err != nil {
49                 res = append(res, err)
50         }
51
52         if err := m.validateActionType(formats); err != nil {
53                 res = append(res, err)
54         }
55
56         if err := m.validateSubsequentAction(formats); err != nil {
57                 res = append(res, err)
58         }
59
60         if len(res) > 0 {
61                 return errors.CompositeValidationError(res...)
62         }
63         return nil
64 }
65
66 func (m *ActionToBeSetup) validateActionDefinition(formats strfmt.Registry) error {
67
68         if swag.IsZero(m.ActionDefinition) { // not required
69                 return nil
70         }
71
72         if err := m.ActionDefinition.Validate(formats); err != nil {
73                 if ve, ok := err.(*errors.Validation); ok {
74                         return ve.ValidateName("ActionDefinition")
75                 }
76                 return err
77         }
78
79         return nil
80 }
81
82 func (m *ActionToBeSetup) validateActionID(formats strfmt.Registry) error {
83
84         if err := validate.Required("ActionID", "body", m.ActionID); err != nil {
85                 return err
86         }
87
88         if err := validate.MinimumInt("ActionID", "body", int64(*m.ActionID), 0, false); err != nil {
89                 return err
90         }
91
92         if err := validate.MaximumInt("ActionID", "body", int64(*m.ActionID), 255, false); err != nil {
93                 return err
94         }
95
96         return nil
97 }
98
99 var actionToBeSetupTypeActionTypePropEnum []interface{}
100
101 func init() {
102         var res []string
103         if err := json.Unmarshal([]byte(`["insert","policy","report"]`), &res); err != nil {
104                 panic(err)
105         }
106         for _, v := range res {
107                 actionToBeSetupTypeActionTypePropEnum = append(actionToBeSetupTypeActionTypePropEnum, v)
108         }
109 }
110
111 const (
112
113         // ActionToBeSetupActionTypeInsert captures enum value "insert"
114         ActionToBeSetupActionTypeInsert string = "insert"
115
116         // ActionToBeSetupActionTypePolicy captures enum value "policy"
117         ActionToBeSetupActionTypePolicy string = "policy"
118
119         // ActionToBeSetupActionTypeReport captures enum value "report"
120         ActionToBeSetupActionTypeReport string = "report"
121 )
122
123 // prop value enum
124 func (m *ActionToBeSetup) validateActionTypeEnum(path, location string, value string) error {
125         if err := validate.Enum(path, location, value, actionToBeSetupTypeActionTypePropEnum); err != nil {
126                 return err
127         }
128         return nil
129 }
130
131 func (m *ActionToBeSetup) validateActionType(formats strfmt.Registry) error {
132
133         if err := validate.Required("ActionType", "body", m.ActionType); err != nil {
134                 return err
135         }
136
137         // value enum
138         if err := m.validateActionTypeEnum("ActionType", "body", *m.ActionType); err != nil {
139                 return err
140         }
141
142         return nil
143 }
144
145 func (m *ActionToBeSetup) validateSubsequentAction(formats strfmt.Registry) error {
146
147         if swag.IsZero(m.SubsequentAction) { // not required
148                 return nil
149         }
150
151         if m.SubsequentAction != nil {
152                 if err := m.SubsequentAction.Validate(formats); err != nil {
153                         if ve, ok := err.(*errors.Validation); ok {
154                                 return ve.ValidateName("SubsequentAction")
155                         }
156                         return err
157                 }
158         }
159
160         return nil
161 }
162
163 // MarshalBinary interface implementation
164 func (m *ActionToBeSetup) MarshalBinary() ([]byte, error) {
165         if m == nil {
166                 return nil, nil
167         }
168         return swag.WriteJSON(m)
169 }
170
171 // UnmarshalBinary interface implementation
172 func (m *ActionToBeSetup) UnmarshalBinary(b []byte) error {
173         var res ActionToBeSetup
174         if err := swag.ReadJSON(b, &res); err != nil {
175                 return err
176         }
177         *m = res
178         return nil
179 }