This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
cluster_v2_request.go
241 lines (178 loc) · 5.44 KB
/
cluster_v2_request.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
// Code generated by go-swagger; DO NOT EDIT.
package models_cloudbreak
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
"strconv"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// ClusterV2Request cluster v2 request
// swagger:model ClusterV2Request
type ClusterV2Request struct {
// ambari specific requests
AmbariRequest *AmbariV2Request `json:"ambariRequest,omitempty"`
// send email about the result of the cluster installation
EmailNeeded *bool `json:"emailNeeded,omitempty"`
// send email to the requested address
EmailTo string `json:"emailTo,omitempty"`
// executor type of cluster
ExecutorType string `json:"executorType,omitempty"`
// external file system configuration
FileSystem *FileSystem `json:"fileSystem,omitempty"`
// LDAP config name for the cluster
LdapConfigName string `json:"ldapConfigName,omitempty"`
// RDS configuration ids for the cluster
// Unique: true
RdsConfigIds []int64 `json:"rdsConfigIds"`
// details of the external database for Hadoop components
// Unique: true
RdsConfigJsons []*RDSConfig `json:"rdsConfigJsons"`
}
/* polymorph ClusterV2Request ambariRequest false */
/* polymorph ClusterV2Request emailNeeded false */
/* polymorph ClusterV2Request emailTo false */
/* polymorph ClusterV2Request executorType false */
/* polymorph ClusterV2Request fileSystem false */
/* polymorph ClusterV2Request ldapConfigName false */
/* polymorph ClusterV2Request rdsConfigIds false */
/* polymorph ClusterV2Request rdsConfigJsons false */
// Validate validates this cluster v2 request
func (m *ClusterV2Request) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAmbariRequest(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateExecutorType(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateFileSystem(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateRdsConfigIds(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateRdsConfigJsons(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ClusterV2Request) validateAmbariRequest(formats strfmt.Registry) error {
if swag.IsZero(m.AmbariRequest) { // not required
return nil
}
if m.AmbariRequest != nil {
if err := m.AmbariRequest.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("ambariRequest")
}
return err
}
}
return nil
}
var clusterV2RequestTypeExecutorTypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["CONTAINER","DEFAULT"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
clusterV2RequestTypeExecutorTypePropEnum = append(clusterV2RequestTypeExecutorTypePropEnum, v)
}
}
const (
// ClusterV2RequestExecutorTypeCONTAINER captures enum value "CONTAINER"
ClusterV2RequestExecutorTypeCONTAINER string = "CONTAINER"
// ClusterV2RequestExecutorTypeDEFAULT captures enum value "DEFAULT"
ClusterV2RequestExecutorTypeDEFAULT string = "DEFAULT"
)
// prop value enum
func (m *ClusterV2Request) validateExecutorTypeEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, clusterV2RequestTypeExecutorTypePropEnum); err != nil {
return err
}
return nil
}
func (m *ClusterV2Request) validateExecutorType(formats strfmt.Registry) error {
if swag.IsZero(m.ExecutorType) { // not required
return nil
}
// value enum
if err := m.validateExecutorTypeEnum("executorType", "body", m.ExecutorType); err != nil {
return err
}
return nil
}
func (m *ClusterV2Request) validateFileSystem(formats strfmt.Registry) error {
if swag.IsZero(m.FileSystem) { // not required
return nil
}
if m.FileSystem != nil {
if err := m.FileSystem.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("fileSystem")
}
return err
}
}
return nil
}
func (m *ClusterV2Request) validateRdsConfigIds(formats strfmt.Registry) error {
if swag.IsZero(m.RdsConfigIds) { // not required
return nil
}
if err := validate.UniqueItems("rdsConfigIds", "body", m.RdsConfigIds); err != nil {
return err
}
return nil
}
func (m *ClusterV2Request) validateRdsConfigJsons(formats strfmt.Registry) error {
if swag.IsZero(m.RdsConfigJsons) { // not required
return nil
}
if err := validate.UniqueItems("rdsConfigJsons", "body", m.RdsConfigJsons); err != nil {
return err
}
for i := 0; i < len(m.RdsConfigJsons); i++ {
if swag.IsZero(m.RdsConfigJsons[i]) { // not required
continue
}
if m.RdsConfigJsons[i] != nil {
if err := m.RdsConfigJsons[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("rdsConfigJsons" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *ClusterV2Request) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ClusterV2Request) UnmarshalBinary(b []byte) error {
var res ClusterV2Request
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}