blob: c62b4f10c2a529d2c31ba5c7cf2a067bde103650 [file] [log] [blame]
Mohamed Abukar429da192020-02-26 16:46:34 +02001// Code generated by go-swagger; DO NOT EDIT.
2
3package 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
8import (
9 "strconv"
10
11 strfmt "github.com/go-openapi/strfmt"
12
13 "github.com/go-openapi/errors"
14 "github.com/go-openapi/swag"
Mohamed Abukarb6341a52020-03-23 08:55:05 +020015 "github.com/go-openapi/validate"
Mohamed Abukar429da192020-02-26 16:46:34 +020016)
17
18// SubscriptionResponse subscription response
19// swagger:model SubscriptionResponse
Mohamed Abukarb6341a52020-03-23 08:55:05 +020020type SubscriptionResponse struct {
21
22 // subscription Id
23 // Required: true
24 SubscriptionID *string `json:"SubscriptionId"`
25
26 // subscription instances
27 // Required: true
28 SubscriptionInstances []*SubscriptionInstance `json:"SubscriptionInstances"`
29}
Mohamed Abukar429da192020-02-26 16:46:34 +020030
31// Validate validates this subscription response
Mohamed Abukarb6341a52020-03-23 08:55:05 +020032func (m *SubscriptionResponse) Validate(formats strfmt.Registry) error {
Mohamed Abukar429da192020-02-26 16:46:34 +020033 var res []error
34
Mohamed Abukarb6341a52020-03-23 08:55:05 +020035 if err := m.validateSubscriptionID(formats); err != nil {
36 res = append(res, err)
37 }
38
39 if err := m.validateSubscriptionInstances(formats); err != nil {
40 res = append(res, err)
41 }
42
43 if len(res) > 0 {
44 return errors.CompositeValidationError(res...)
45 }
46 return nil
47}
48
49func (m *SubscriptionResponse) validateSubscriptionID(formats strfmt.Registry) error {
50
51 if err := validate.Required("SubscriptionId", "body", m.SubscriptionID); err != nil {
52 return err
53 }
54
55 return nil
56}
57
58func (m *SubscriptionResponse) validateSubscriptionInstances(formats strfmt.Registry) error {
59
60 if err := validate.Required("SubscriptionInstances", "body", m.SubscriptionInstances); err != nil {
61 return err
62 }
63
64 for i := 0; i < len(m.SubscriptionInstances); i++ {
65 if swag.IsZero(m.SubscriptionInstances[i]) { // not required
Mohamed Abukar429da192020-02-26 16:46:34 +020066 continue
67 }
68
Mohamed Abukarb6341a52020-03-23 08:55:05 +020069 if m.SubscriptionInstances[i] != nil {
70 if err := m.SubscriptionInstances[i].Validate(formats); err != nil {
Mohamed Abukar429da192020-02-26 16:46:34 +020071 if ve, ok := err.(*errors.Validation); ok {
Mohamed Abukarb6341a52020-03-23 08:55:05 +020072 return ve.ValidateName("SubscriptionInstances" + "." + strconv.Itoa(i))
Mohamed Abukar429da192020-02-26 16:46:34 +020073 }
74 return err
75 }
76 }
77
78 }
79
Mohamed Abukarb6341a52020-03-23 08:55:05 +020080 return nil
81}
82
83// MarshalBinary interface implementation
84func (m *SubscriptionResponse) MarshalBinary() ([]byte, error) {
85 if m == nil {
86 return nil, nil
Mohamed Abukar429da192020-02-26 16:46:34 +020087 }
Mohamed Abukarb6341a52020-03-23 08:55:05 +020088 return swag.WriteJSON(m)
89}
90
91// UnmarshalBinary interface implementation
92func (m *SubscriptionResponse) UnmarshalBinary(b []byte) error {
93 var res SubscriptionResponse
94 if err := swag.ReadJSON(b, &res); err != nil {
95 return err
96 }
97 *m = res
Mohamed Abukar429da192020-02-26 16:46:34 +020098 return nil
99}