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
/
stack_response.go
764 lines (555 loc) · 19.3 KB
/
stack_response.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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
// 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"
)
// StackResponse stack response
// swagger:model StackResponse
type StackResponse struct {
// account id of the resource owner that is provided by OAuth provider
Account string `json:"account,omitempty"`
// specific version of ambari
AmbariVersion string `json:"ambariVersion,omitempty"`
// stack related application tags
ApplicationTags map[string]string `json:"applicationTags,omitempty"`
// availability zone of the stack
AvailabilityZone string `json:"availabilityZone,omitempty"`
// type of cloud provider
// Read Only: true
CloudPlatform string `json:"cloudPlatform,omitempty"`
// details of the Cloudbreak that provisioned the stack
CloudbreakDetails *CloudbreakDetailsJSON `json:"cloudbreakDetails,omitempty"`
// related events for a cloudbreak stack
CloudbreakEvents []*CloudbreakEvent `json:"cloudbreakEvents"`
// usage information for a specific stack
CloudbreakUsages []*CloudbreakUsage `json:"cloudbreakUsages"`
// cluster
Cluster *ClusterResponse `json:"cluster,omitempty"`
// using the cluster name to create subdomain
ClusterNameAsSubdomain *bool `json:"clusterNameAsSubdomain,omitempty"`
// creation time of the stack in long
Created int64 `json:"created,omitempty"`
// stack related credential
Credential *CredentialResponse `json:"credential,omitempty"`
// credential resource id for the stack
CredentialID int64 `json:"credentialId,omitempty"`
// custom domain name for the nodes in the stack
CustomDomain string `json:"customDomain,omitempty"`
// custom hostname for nodes in the stack
CustomHostname string `json:"customHostname,omitempty"`
// Custom parameters as a json
CustomInputs map[string]interface{} `json:"customInputs,omitempty"`
// stack related default tags
DefaultTags map[string]string `json:"defaultTags,omitempty"`
// failure policy in case of failures
FailurePolicy *FailurePolicyResponse `json:"failurePolicy,omitempty"`
// the related flex subscription
FlexSubscription *FlexSubscriptionResponse `json:"flexSubscription,omitempty"`
// port of the gateway secured proxy
GatewayPort int32 `json:"gatewayPort,omitempty"`
// hardware information where pairing hostmetadata with instancemetadata
// Unique: true
HardwareInfoGroups []*HardwareInfoGroupResponse `json:"hardwareInfoGroups"`
// specific version of HDP
HdpVersion string `json:"hdpVersion,omitempty"`
// using the hostgroup names to create hostnames
HostgroupNameAsHostname *bool `json:"hostgroupNameAsHostname,omitempty"`
// id of the stack
ID int64 `json:"id,omitempty"`
// image of the stack
Image *ImageJSON `json:"image,omitempty"`
// instance groups
InstanceGroups []*InstanceGroupResponse `json:"instanceGroups"`
// name of the stack
// Required: true
// Max Length: 40
// Min Length: 5
// Pattern: (^[a-z][-a-z0-9]*[a-z0-9]$)
Name *string `json:"name"`
// stack related network
Network *NetworkResponse `json:"network,omitempty"`
// network resource id for the stack
NetworkID int64 `json:"networkId,omitempty"`
// node count of the stack
NodeCount int32 `json:"nodeCount,omitempty"`
// action on failure
OnFailureAction string `json:"onFailureAction,omitempty"`
// the details of the container orchestrator api to use
Orchestrator *OrchestratorResponse `json:"orchestrator,omitempty"`
// id of the resource owner that is provided by OAuth provider
Owner string `json:"owner,omitempty"`
// additional cloud specific parameters for stack
Parameters map[string]string `json:"parameters,omitempty"`
// cloud provider api variant
PlatformVariant string `json:"platformVariant,omitempty"`
// resource is visible in account
Public *bool `json:"public,omitempty"`
// region of the stack
Region string `json:"region,omitempty"`
// stack related authentication
StackAuthentication *StackAuthenticationResponse `json:"stackAuthentication,omitempty"`
// status of the stack
Status string `json:"status,omitempty"`
// status message of the stack
StatusReason string `json:"statusReason,omitempty"`
// stack related userdefined tags
UserDefinedTags map[string]string `json:"userDefinedTags,omitempty"`
}
/* polymorph StackResponse account false */
/* polymorph StackResponse ambariVersion false */
/* polymorph StackResponse applicationTags false */
/* polymorph StackResponse availabilityZone false */
/* polymorph StackResponse cloudPlatform false */
/* polymorph StackResponse cloudbreakDetails false */
/* polymorph StackResponse cloudbreakEvents false */
/* polymorph StackResponse cloudbreakUsages false */
/* polymorph StackResponse cluster false */
/* polymorph StackResponse clusterNameAsSubdomain false */
/* polymorph StackResponse created false */
/* polymorph StackResponse credential false */
/* polymorph StackResponse credentialId false */
/* polymorph StackResponse customDomain false */
/* polymorph StackResponse customHostname false */
/* polymorph StackResponse customInputs false */
/* polymorph StackResponse defaultTags false */
/* polymorph StackResponse failurePolicy false */
/* polymorph StackResponse flexSubscription false */
/* polymorph StackResponse gatewayPort false */
/* polymorph StackResponse hardwareInfoGroups false */
/* polymorph StackResponse hdpVersion false */
/* polymorph StackResponse hostgroupNameAsHostname false */
/* polymorph StackResponse id false */
/* polymorph StackResponse image false */
/* polymorph StackResponse instanceGroups false */
/* polymorph StackResponse name false */
/* polymorph StackResponse network false */
/* polymorph StackResponse networkId false */
/* polymorph StackResponse nodeCount false */
/* polymorph StackResponse onFailureAction false */
/* polymorph StackResponse orchestrator false */
/* polymorph StackResponse owner false */
/* polymorph StackResponse parameters false */
/* polymorph StackResponse platformVariant false */
/* polymorph StackResponse public false */
/* polymorph StackResponse region false */
/* polymorph StackResponse stackAuthentication false */
/* polymorph StackResponse status false */
/* polymorph StackResponse statusReason false */
/* polymorph StackResponse userDefinedTags false */
// Validate validates this stack response
func (m *StackResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCloudbreakDetails(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateCloudbreakEvents(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateCloudbreakUsages(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateCluster(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateCredential(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateFailurePolicy(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateFlexSubscription(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateHardwareInfoGroups(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateImage(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateInstanceGroups(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateNetwork(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateOnFailureAction(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateOrchestrator(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateStackAuthentication(formats); err != nil {
// prop
res = append(res, err)
}
if err := m.validateStatus(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *StackResponse) validateCloudbreakDetails(formats strfmt.Registry) error {
if swag.IsZero(m.CloudbreakDetails) { // not required
return nil
}
if m.CloudbreakDetails != nil {
if err := m.CloudbreakDetails.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("cloudbreakDetails")
}
return err
}
}
return nil
}
func (m *StackResponse) validateCloudbreakEvents(formats strfmt.Registry) error {
if swag.IsZero(m.CloudbreakEvents) { // not required
return nil
}
for i := 0; i < len(m.CloudbreakEvents); i++ {
if swag.IsZero(m.CloudbreakEvents[i]) { // not required
continue
}
if m.CloudbreakEvents[i] != nil {
if err := m.CloudbreakEvents[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("cloudbreakEvents" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *StackResponse) validateCloudbreakUsages(formats strfmt.Registry) error {
if swag.IsZero(m.CloudbreakUsages) { // not required
return nil
}
for i := 0; i < len(m.CloudbreakUsages); i++ {
if swag.IsZero(m.CloudbreakUsages[i]) { // not required
continue
}
if m.CloudbreakUsages[i] != nil {
if err := m.CloudbreakUsages[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("cloudbreakUsages" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *StackResponse) validateCluster(formats strfmt.Registry) error {
if swag.IsZero(m.Cluster) { // not required
return nil
}
if m.Cluster != nil {
if err := m.Cluster.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("cluster")
}
return err
}
}
return nil
}
func (m *StackResponse) validateCredential(formats strfmt.Registry) error {
if swag.IsZero(m.Credential) { // not required
return nil
}
if m.Credential != nil {
if err := m.Credential.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("credential")
}
return err
}
}
return nil
}
func (m *StackResponse) validateFailurePolicy(formats strfmt.Registry) error {
if swag.IsZero(m.FailurePolicy) { // not required
return nil
}
if m.FailurePolicy != nil {
if err := m.FailurePolicy.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("failurePolicy")
}
return err
}
}
return nil
}
func (m *StackResponse) validateFlexSubscription(formats strfmt.Registry) error {
if swag.IsZero(m.FlexSubscription) { // not required
return nil
}
if m.FlexSubscription != nil {
if err := m.FlexSubscription.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("flexSubscription")
}
return err
}
}
return nil
}
func (m *StackResponse) validateHardwareInfoGroups(formats strfmt.Registry) error {
if swag.IsZero(m.HardwareInfoGroups) { // not required
return nil
}
if err := validate.UniqueItems("hardwareInfoGroups", "body", m.HardwareInfoGroups); err != nil {
return err
}
for i := 0; i < len(m.HardwareInfoGroups); i++ {
if swag.IsZero(m.HardwareInfoGroups[i]) { // not required
continue
}
if m.HardwareInfoGroups[i] != nil {
if err := m.HardwareInfoGroups[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("hardwareInfoGroups" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *StackResponse) validateImage(formats strfmt.Registry) error {
if swag.IsZero(m.Image) { // not required
return nil
}
if m.Image != nil {
if err := m.Image.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("image")
}
return err
}
}
return nil
}
func (m *StackResponse) validateInstanceGroups(formats strfmt.Registry) error {
if swag.IsZero(m.InstanceGroups) { // not required
return nil
}
for i := 0; i < len(m.InstanceGroups); i++ {
if swag.IsZero(m.InstanceGroups[i]) { // not required
continue
}
if m.InstanceGroups[i] != nil {
if err := m.InstanceGroups[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("instanceGroups" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *StackResponse) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
if err := validate.MinLength("name", "body", string(*m.Name), 5); err != nil {
return err
}
if err := validate.MaxLength("name", "body", string(*m.Name), 40); err != nil {
return err
}
if err := validate.Pattern("name", "body", string(*m.Name), `(^[a-z][-a-z0-9]*[a-z0-9]$)`); err != nil {
return err
}
return nil
}
func (m *StackResponse) validateNetwork(formats strfmt.Registry) error {
if swag.IsZero(m.Network) { // not required
return nil
}
if m.Network != nil {
if err := m.Network.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("network")
}
return err
}
}
return nil
}
var stackResponseTypeOnFailureActionPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["ROLLBACK","DO_NOTHING"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
stackResponseTypeOnFailureActionPropEnum = append(stackResponseTypeOnFailureActionPropEnum, v)
}
}
const (
// StackResponseOnFailureActionROLLBACK captures enum value "ROLLBACK"
StackResponseOnFailureActionROLLBACK string = "ROLLBACK"
// StackResponseOnFailureActionDONOTHING captures enum value "DO_NOTHING"
StackResponseOnFailureActionDONOTHING string = "DO_NOTHING"
)
// prop value enum
func (m *StackResponse) validateOnFailureActionEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, stackResponseTypeOnFailureActionPropEnum); err != nil {
return err
}
return nil
}
func (m *StackResponse) validateOnFailureAction(formats strfmt.Registry) error {
if swag.IsZero(m.OnFailureAction) { // not required
return nil
}
// value enum
if err := m.validateOnFailureActionEnum("onFailureAction", "body", m.OnFailureAction); err != nil {
return err
}
return nil
}
func (m *StackResponse) validateOrchestrator(formats strfmt.Registry) error {
if swag.IsZero(m.Orchestrator) { // not required
return nil
}
if m.Orchestrator != nil {
if err := m.Orchestrator.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("orchestrator")
}
return err
}
}
return nil
}
func (m *StackResponse) validateStackAuthentication(formats strfmt.Registry) error {
if swag.IsZero(m.StackAuthentication) { // not required
return nil
}
if m.StackAuthentication != nil {
if err := m.StackAuthentication.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("stackAuthentication")
}
return err
}
}
return nil
}
var stackResponseTypeStatusPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["REQUESTED","CREATE_IN_PROGRESS","AVAILABLE","UPDATE_IN_PROGRESS","UPDATE_REQUESTED","UPDATE_FAILED","CREATE_FAILED","ENABLE_SECURITY_FAILED","PRE_DELETE_IN_PROGRESS","DELETE_IN_PROGRESS","DELETE_FAILED","DELETE_COMPLETED","STOPPED","STOP_REQUESTED","START_REQUESTED","STOP_IN_PROGRESS","START_IN_PROGRESS","START_FAILED","STOP_FAILED","WAIT_FOR_SYNC"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
stackResponseTypeStatusPropEnum = append(stackResponseTypeStatusPropEnum, v)
}
}
const (
// StackResponseStatusREQUESTED captures enum value "REQUESTED"
StackResponseStatusREQUESTED string = "REQUESTED"
// StackResponseStatusCREATEINPROGRESS captures enum value "CREATE_IN_PROGRESS"
StackResponseStatusCREATEINPROGRESS string = "CREATE_IN_PROGRESS"
// StackResponseStatusAVAILABLE captures enum value "AVAILABLE"
StackResponseStatusAVAILABLE string = "AVAILABLE"
// StackResponseStatusUPDATEINPROGRESS captures enum value "UPDATE_IN_PROGRESS"
StackResponseStatusUPDATEINPROGRESS string = "UPDATE_IN_PROGRESS"
// StackResponseStatusUPDATEREQUESTED captures enum value "UPDATE_REQUESTED"
StackResponseStatusUPDATEREQUESTED string = "UPDATE_REQUESTED"
// StackResponseStatusUPDATEFAILED captures enum value "UPDATE_FAILED"
StackResponseStatusUPDATEFAILED string = "UPDATE_FAILED"
// StackResponseStatusCREATEFAILED captures enum value "CREATE_FAILED"
StackResponseStatusCREATEFAILED string = "CREATE_FAILED"
// StackResponseStatusENABLESECURITYFAILED captures enum value "ENABLE_SECURITY_FAILED"
StackResponseStatusENABLESECURITYFAILED string = "ENABLE_SECURITY_FAILED"
// StackResponseStatusPREDELETEINPROGRESS captures enum value "PRE_DELETE_IN_PROGRESS"
StackResponseStatusPREDELETEINPROGRESS string = "PRE_DELETE_IN_PROGRESS"
// StackResponseStatusDELETEINPROGRESS captures enum value "DELETE_IN_PROGRESS"
StackResponseStatusDELETEINPROGRESS string = "DELETE_IN_PROGRESS"
// StackResponseStatusDELETEFAILED captures enum value "DELETE_FAILED"
StackResponseStatusDELETEFAILED string = "DELETE_FAILED"
// StackResponseStatusDELETECOMPLETED captures enum value "DELETE_COMPLETED"
StackResponseStatusDELETECOMPLETED string = "DELETE_COMPLETED"
// StackResponseStatusSTOPPED captures enum value "STOPPED"
StackResponseStatusSTOPPED string = "STOPPED"
// StackResponseStatusSTOPREQUESTED captures enum value "STOP_REQUESTED"
StackResponseStatusSTOPREQUESTED string = "STOP_REQUESTED"
// StackResponseStatusSTARTREQUESTED captures enum value "START_REQUESTED"
StackResponseStatusSTARTREQUESTED string = "START_REQUESTED"
// StackResponseStatusSTOPINPROGRESS captures enum value "STOP_IN_PROGRESS"
StackResponseStatusSTOPINPROGRESS string = "STOP_IN_PROGRESS"
// StackResponseStatusSTARTINPROGRESS captures enum value "START_IN_PROGRESS"
StackResponseStatusSTARTINPROGRESS string = "START_IN_PROGRESS"
// StackResponseStatusSTARTFAILED captures enum value "START_FAILED"
StackResponseStatusSTARTFAILED string = "START_FAILED"
// StackResponseStatusSTOPFAILED captures enum value "STOP_FAILED"
StackResponseStatusSTOPFAILED string = "STOP_FAILED"
// StackResponseStatusWAITFORSYNC captures enum value "WAIT_FOR_SYNC"
StackResponseStatusWAITFORSYNC string = "WAIT_FOR_SYNC"
)
// prop value enum
func (m *StackResponse) validateStatusEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, stackResponseTypeStatusPropEnum); err != nil {
return err
}
return nil
}
func (m *StackResponse) validateStatus(formats strfmt.Registry) error {
if swag.IsZero(m.Status) { // not required
return nil
}
// value enum
if err := m.validateStatusEnum("status", "body", m.Status); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *StackResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *StackResponse) UnmarshalBinary(b []byte) error {
var res StackResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}