Enhancements of REST-based E2 subscription interface
[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         strfmt "github.com/go-openapi/strfmt"
12
13         "github.com/go-openapi/errors"
14         "github.com/go-openapi/swag"
15         "github.com/go-openapi/validate"
16 )
17
18 // ActionToBeSetup action to be setup
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 m.ActionDefinition != nil {
73                 if err := m.ActionDefinition.Validate(formats); err != nil {
74                         if ve, ok := err.(*errors.Validation); ok {
75                                 return ve.ValidateName("ActionDefinition")
76                         }
77                         return err
78                 }
79         }
80
81         return nil
82 }
83
84 func (m *ActionToBeSetup) validateActionID(formats strfmt.Registry) error {
85
86         if err := validate.Required("ActionID", "body", m.ActionID); err != nil {
87                 return err
88         }
89
90         if err := validate.MinimumInt("ActionID", "body", int64(*m.ActionID), 0, false); err != nil {
91                 return err
92         }
93
94         if err := validate.MaximumInt("ActionID", "body", int64(*m.ActionID), 255, false); err != nil {
95                 return err
96         }
97
98         return nil
99 }
100
101 var actionToBeSetupTypeActionTypePropEnum []interface{}
102
103 func init() {
104         var res []string
105         if err := json.Unmarshal([]byte(`["insert","policy","report"]`), &res); err != nil {
106                 panic(err)
107         }
108         for _, v := range res {
109                 actionToBeSetupTypeActionTypePropEnum = append(actionToBeSetupTypeActionTypePropEnum, v)
110         }
111 }
112
113 const (
114
115         // ActionToBeSetupActionTypeInsert captures enum value "insert"
116         ActionToBeSetupActionTypeInsert string = "insert"
117
118         // ActionToBeSetupActionTypePolicy captures enum value "policy"
119         ActionToBeSetupActionTypePolicy string = "policy"
120
121         // ActionToBeSetupActionTypeReport captures enum value "report"
122         ActionToBeSetupActionTypeReport string = "report"
123 )
124
125 // prop value enum
126 func (m *ActionToBeSetup) validateActionTypeEnum(path, location string, value string) error {
127         if err := validate.Enum(path, location, value, actionToBeSetupTypeActionTypePropEnum); err != nil {
128                 return err
129         }
130         return nil
131 }
132
133 func (m *ActionToBeSetup) validateActionType(formats strfmt.Registry) error {
134
135         if err := validate.Required("ActionType", "body", m.ActionType); err != nil {
136                 return err
137         }
138
139         // value enum
140         if err := m.validateActionTypeEnum("ActionType", "body", *m.ActionType); err != nil {
141                 return err
142         }
143
144         return nil
145 }
146
147 func (m *ActionToBeSetup) validateSubsequentAction(formats strfmt.Registry) error {
148
149         if swag.IsZero(m.SubsequentAction) { // not required
150                 return nil
151         }
152
153         if m.SubsequentAction != nil {
154                 if err := m.SubsequentAction.Validate(formats); err != nil {
155                         if ve, ok := err.(*errors.Validation); ok {
156                                 return ve.ValidateName("SubsequentAction")
157                         }
158                         return err
159                 }
160         }
161
162         return nil
163 }
164
165 // MarshalBinary interface implementation
166 func (m *ActionToBeSetup) MarshalBinary() ([]byte, error) {
167         if m == nil {
168                 return nil, nil
169         }
170         return swag.WriteJSON(m)
171 }
172
173 // UnmarshalBinary interface implementation
174 func (m *ActionToBeSetup) UnmarshalBinary(b []byte) error {
175         var res ActionToBeSetup
176         if err := swag.ReadJSON(b, &res); err != nil {
177                 return err
178         }
179         *m = res
180         return nil
181 }