REST API: use byte array for E2SM event trigger
[ric-plt/xapp-frame.git] / pkg / models / subscription_detail.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         "github.com/go-openapi/errors"
10         "github.com/go-openapi/strfmt"
11         "github.com/go-openapi/swag"
12         "github.com/go-openapi/validate"
13 )
14
15 // SubscriptionDetail subscription detail
16 //
17 // swagger:model SubscriptionDetail
18 type SubscriptionDetail struct {
19
20         // action to be setup list
21         // Required: true
22         ActionToBeSetupList ActionsToBeSetup `json:"ActionToBeSetupList"`
23
24         // event triggers
25         // Required: true
26         EventTriggers EventTriggerDefinition `json:"EventTriggers"`
27
28         // xapp event instance Id
29         // Required: true
30         // Maximum: 65535
31         // Minimum: 0
32         XappEventInstanceID *int64 `json:"XappEventInstanceId"`
33 }
34
35 // Validate validates this subscription detail
36 func (m *SubscriptionDetail) Validate(formats strfmt.Registry) error {
37         var res []error
38
39         if err := m.validateActionToBeSetupList(formats); err != nil {
40                 res = append(res, err)
41         }
42
43         if err := m.validateEventTriggers(formats); err != nil {
44                 res = append(res, err)
45         }
46
47         if err := m.validateXappEventInstanceID(formats); err != nil {
48                 res = append(res, err)
49         }
50
51         if len(res) > 0 {
52                 return errors.CompositeValidationError(res...)
53         }
54         return nil
55 }
56
57 func (m *SubscriptionDetail) validateActionToBeSetupList(formats strfmt.Registry) error {
58
59         if err := validate.Required("ActionToBeSetupList", "body", m.ActionToBeSetupList); err != nil {
60                 return err
61         }
62
63         if err := m.ActionToBeSetupList.Validate(formats); err != nil {
64                 if ve, ok := err.(*errors.Validation); ok {
65                         return ve.ValidateName("ActionToBeSetupList")
66                 }
67                 return err
68         }
69
70         return nil
71 }
72
73 func (m *SubscriptionDetail) validateEventTriggers(formats strfmt.Registry) error {
74
75         if err := validate.Required("EventTriggers", "body", m.EventTriggers); err != nil {
76                 return err
77         }
78
79         if err := m.EventTriggers.Validate(formats); err != nil {
80                 if ve, ok := err.(*errors.Validation); ok {
81                         return ve.ValidateName("EventTriggers")
82                 }
83                 return err
84         }
85
86         return nil
87 }
88
89 func (m *SubscriptionDetail) validateXappEventInstanceID(formats strfmt.Registry) error {
90
91         if err := validate.Required("XappEventInstanceId", "body", m.XappEventInstanceID); err != nil {
92                 return err
93         }
94
95         if err := validate.MinimumInt("XappEventInstanceId", "body", int64(*m.XappEventInstanceID), 0, false); err != nil {
96                 return err
97         }
98
99         if err := validate.MaximumInt("XappEventInstanceId", "body", int64(*m.XappEventInstanceID), 65535, false); err != nil {
100                 return err
101         }
102
103         return nil
104 }
105
106 // MarshalBinary interface implementation
107 func (m *SubscriptionDetail) MarshalBinary() ([]byte, error) {
108         if m == nil {
109                 return nil, nil
110         }
111         return swag.WriteJSON(m)
112 }
113
114 // UnmarshalBinary interface implementation
115 func (m *SubscriptionDetail) UnmarshalBinary(b []byte) error {
116         var res SubscriptionDetail
117         if err := swag.ReadJSON(b, &res); err != nil {
118                 return err
119         }
120         *m = res
121         return nil
122 }