1 // Code generated by go-swagger; DO NOT EDIT.
5 // This file was generated by the swagger tool.
6 // Editing this file might prove futile when you re-run the swagger generate command
11 "github.com/go-openapi/errors"
12 "github.com/go-openapi/strfmt"
13 "github.com/go-openapi/swag"
14 "github.com/go-openapi/validate"
17 // SubscriptionInstance subscription instance
19 // swagger:model SubscriptionInstance
20 type SubscriptionInstance struct {
22 // e2 event instance Id
26 E2EventInstanceID *int64 `json:"E2EventInstanceId"`
28 // Descriptive error cause. Empty string when no error.
29 ErrorCause string `json:"ErrorCause,omitempty"`
31 // Source of error cause.
32 // Enum: [SUBMGR RTMGR DBAAS ASN1 E2Node]
33 ErrorSource string `json:"ErrorSource,omitempty"`
35 // Type timeout. xApp should retry if timeout occurs.
36 // Enum: [E2-Timeout RTMGR-Timeout DBAAS-Timeout]
37 TimeoutType string `json:"TimeoutType,omitempty"`
39 // xapp event instance Id
43 XappEventInstanceID *int64 `json:"XappEventInstanceId"`
46 // Validate validates this subscription instance
47 func (m *SubscriptionInstance) Validate(formats strfmt.Registry) error {
50 if err := m.validateE2EventInstanceID(formats); err != nil {
51 res = append(res, err)
54 if err := m.validateErrorSource(formats); err != nil {
55 res = append(res, err)
58 if err := m.validateTimeoutType(formats); err != nil {
59 res = append(res, err)
62 if err := m.validateXappEventInstanceID(formats); err != nil {
63 res = append(res, err)
67 return errors.CompositeValidationError(res...)
72 func (m *SubscriptionInstance) validateE2EventInstanceID(formats strfmt.Registry) error {
74 if err := validate.Required("E2EventInstanceId", "body", m.E2EventInstanceID); err != nil {
78 if err := validate.MinimumInt("E2EventInstanceId", "body", int64(*m.E2EventInstanceID), 0, false); err != nil {
82 if err := validate.MaximumInt("E2EventInstanceId", "body", int64(*m.E2EventInstanceID), 65535, false); err != nil {
89 var subscriptionInstanceTypeErrorSourcePropEnum []interface{}
93 if err := json.Unmarshal([]byte(`["SUBMGR","RTMGR","DBAAS","ASN1","E2Node"]`), &res); err != nil {
96 for _, v := range res {
97 subscriptionInstanceTypeErrorSourcePropEnum = append(subscriptionInstanceTypeErrorSourcePropEnum, v)
103 // SubscriptionInstanceErrorSourceSUBMGR captures enum value "SUBMGR"
104 SubscriptionInstanceErrorSourceSUBMGR string = "SUBMGR"
106 // SubscriptionInstanceErrorSourceRTMGR captures enum value "RTMGR"
107 SubscriptionInstanceErrorSourceRTMGR string = "RTMGR"
109 // SubscriptionInstanceErrorSourceDBAAS captures enum value "DBAAS"
110 SubscriptionInstanceErrorSourceDBAAS string = "DBAAS"
112 // SubscriptionInstanceErrorSourceASN1 captures enum value "ASN1"
113 SubscriptionInstanceErrorSourceASN1 string = "ASN1"
115 // SubscriptionInstanceErrorSourceE2Node captures enum value "E2Node"
116 SubscriptionInstanceErrorSourceE2Node string = "E2Node"
120 func (m *SubscriptionInstance) validateErrorSourceEnum(path, location string, value string) error {
121 if err := validate.Enum(path, location, value, subscriptionInstanceTypeErrorSourcePropEnum); err != nil {
127 func (m *SubscriptionInstance) validateErrorSource(formats strfmt.Registry) error {
129 if swag.IsZero(m.ErrorSource) { // not required
134 if err := m.validateErrorSourceEnum("ErrorSource", "body", m.ErrorSource); err != nil {
141 var subscriptionInstanceTypeTimeoutTypePropEnum []interface{}
145 if err := json.Unmarshal([]byte(`["E2-Timeout","RTMGR-Timeout","DBAAS-Timeout"]`), &res); err != nil {
148 for _, v := range res {
149 subscriptionInstanceTypeTimeoutTypePropEnum = append(subscriptionInstanceTypeTimeoutTypePropEnum, v)
155 // SubscriptionInstanceTimeoutTypeE2Timeout captures enum value "E2-Timeout"
156 SubscriptionInstanceTimeoutTypeE2Timeout string = "E2-Timeout"
158 // SubscriptionInstanceTimeoutTypeRTMGRTimeout captures enum value "RTMGR-Timeout"
159 SubscriptionInstanceTimeoutTypeRTMGRTimeout string = "RTMGR-Timeout"
161 // SubscriptionInstanceTimeoutTypeDBAASTimeout captures enum value "DBAAS-Timeout"
162 SubscriptionInstanceTimeoutTypeDBAASTimeout string = "DBAAS-Timeout"
166 func (m *SubscriptionInstance) validateTimeoutTypeEnum(path, location string, value string) error {
167 if err := validate.Enum(path, location, value, subscriptionInstanceTypeTimeoutTypePropEnum); err != nil {
173 func (m *SubscriptionInstance) validateTimeoutType(formats strfmt.Registry) error {
175 if swag.IsZero(m.TimeoutType) { // not required
180 if err := m.validateTimeoutTypeEnum("TimeoutType", "body", m.TimeoutType); err != nil {
187 func (m *SubscriptionInstance) validateXappEventInstanceID(formats strfmt.Registry) error {
189 if err := validate.Required("XappEventInstanceId", "body", m.XappEventInstanceID); err != nil {
193 if err := validate.MinimumInt("XappEventInstanceId", "body", int64(*m.XappEventInstanceID), 0, false); err != nil {
197 if err := validate.MaximumInt("XappEventInstanceId", "body", int64(*m.XappEventInstanceID), 65535, false); err != nil {
204 // MarshalBinary interface implementation
205 func (m *SubscriptionInstance) MarshalBinary() ([]byte, error) {
209 return swag.WriteJSON(m)
212 // UnmarshalBinary interface implementation
213 func (m *SubscriptionInstance) UnmarshalBinary(b []byte) error {
214 var res SubscriptionInstance
215 if err := swag.ReadJSON(b, &res); err != nil {