-
Notifications
You must be signed in to change notification settings - Fork 155
/
datacenter_spec_openstack.go
185 lines (145 loc) · 4.95 KB
/
datacenter_spec_openstack.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
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// DatacenterSpecOpenstack DatacenterSpecOpenstack describes an OpenStack datacenter.
//
// swagger:model DatacenterSpecOpenstack
type DatacenterSpecOpenstack struct {
// auth URL
AuthURL string `json:"authURL,omitempty"`
// availability zone
AvailabilityZone string `json:"availabilityZone,omitempty"`
// Used for automatic network creation
DNSServers []string `json:"dnsServers"`
// Optional: List of enabled flavors for the given datacenter
EnabledFlavors []string `json:"enabledFlavors"`
// Optional
EnforceFloatingIP bool `json:"enforceFloatingIP,omitempty"`
// Optional: defines if the IPv6 is enabled for the datacenter
IPV6Enabled bool `json:"ipv6Enabled,omitempty"`
// Optional
IgnoreVolumeAZ bool `json:"ignoreVolumeAZ,omitempty"`
// Optional: Gets mapped to the "manage-security-groups" setting in the cloud config.
// This setting defaults to true.
ManageSecurityGroups bool `json:"manageSecurityGroups,omitempty"`
// region
Region string `json:"region,omitempty"`
// Optional: Gets mapped to the "trust-device-path" setting in the cloud config.
// This setting defaults to false.
TrustDevicePath bool `json:"trustDevicePath,omitempty"`
// Optional: Gets mapped to the "use-octavia" setting in the cloud config.
// use-octavia is enabled by default in CCM since v1.17.0, and disabled by
// default with the in-tree cloud provider.
UseOctavia bool `json:"useOctavia,omitempty"`
// images
Images ImageList `json:"images,omitempty"`
// node size requirements
NodeSizeRequirements *OpenstackNodeSizeRequirements `json:"nodeSizeRequirements,omitempty"`
}
// Validate validates this datacenter spec openstack
func (m *DatacenterSpecOpenstack) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateImages(formats); err != nil {
res = append(res, err)
}
if err := m.validateNodeSizeRequirements(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *DatacenterSpecOpenstack) validateImages(formats strfmt.Registry) error {
if swag.IsZero(m.Images) { // not required
return nil
}
if m.Images != nil {
if err := m.Images.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("images")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("images")
}
return err
}
}
return nil
}
func (m *DatacenterSpecOpenstack) validateNodeSizeRequirements(formats strfmt.Registry) error {
if swag.IsZero(m.NodeSizeRequirements) { // not required
return nil
}
if m.NodeSizeRequirements != nil {
if err := m.NodeSizeRequirements.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("nodeSizeRequirements")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("nodeSizeRequirements")
}
return err
}
}
return nil
}
// ContextValidate validate this datacenter spec openstack based on the context it is used
func (m *DatacenterSpecOpenstack) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateImages(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateNodeSizeRequirements(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *DatacenterSpecOpenstack) contextValidateImages(ctx context.Context, formats strfmt.Registry) error {
if err := m.Images.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("images")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("images")
}
return err
}
return nil
}
func (m *DatacenterSpecOpenstack) contextValidateNodeSizeRequirements(ctx context.Context, formats strfmt.Registry) error {
if m.NodeSizeRequirements != nil {
if err := m.NodeSizeRequirements.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("nodeSizeRequirements")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("nodeSizeRequirements")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *DatacenterSpecOpenstack) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DatacenterSpecOpenstack) UnmarshalBinary(b []byte) error {
var res DatacenterSpecOpenstack
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}