/
openstack_client.go
394 lines (357 loc) · 15.5 KB
/
openstack_client.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
// Code generated by go-swagger; DO NOT EDIT.
package openstack
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new openstack API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for openstack API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientService is the interface for Client methods
type ClientService interface {
ListOpenstackNetworks(params *ListOpenstackNetworksParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackNetworksOK, error)
ListOpenstackNetworksNoCredentials(params *ListOpenstackNetworksNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackNetworksNoCredentialsOK, error)
ListOpenstackSecurityGroups(params *ListOpenstackSecurityGroupsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSecurityGroupsOK, error)
ListOpenstackSecurityGroupsNoCredentials(params *ListOpenstackSecurityGroupsNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSecurityGroupsNoCredentialsOK, error)
ListOpenstackSizes(params *ListOpenstackSizesParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSizesOK, error)
ListOpenstackSizesNoCredentials(params *ListOpenstackSizesNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSizesNoCredentialsOK, error)
ListOpenstackSubnets(params *ListOpenstackSubnetsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSubnetsOK, error)
ListOpenstackSubnetsNoCredentials(params *ListOpenstackSubnetsNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSubnetsNoCredentialsOK, error)
ListOpenstackTenants(params *ListOpenstackTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackTenantsOK, error)
ListOpenstackTenantsNoCredentials(params *ListOpenstackTenantsNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackTenantsNoCredentialsOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
ListOpenstackNetworks Lists networks from openstack
*/
func (a *Client) ListOpenstackNetworks(params *ListOpenstackNetworksParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackNetworksOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackNetworksParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackNetworks",
Method: "GET",
PathPattern: "/api/v1/providers/openstack/networks",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackNetworksReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackNetworksOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackNetworksDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOpenstackNetworksNoCredentials Lists networks from openstack
*/
func (a *Client) ListOpenstackNetworksNoCredentials(params *ListOpenstackNetworksNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackNetworksNoCredentialsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackNetworksNoCredentialsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackNetworksNoCredentials",
Method: "GET",
PathPattern: "/api/v1/projects/{project_id}/dc/{dc}/clusters/{cluster_id}/providers/openstack/networks",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackNetworksNoCredentialsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackNetworksNoCredentialsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackNetworksNoCredentialsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOpenstackSecurityGroups Lists security groups from openstack
*/
func (a *Client) ListOpenstackSecurityGroups(params *ListOpenstackSecurityGroupsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSecurityGroupsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackSecurityGroupsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackSecurityGroups",
Method: "GET",
PathPattern: "/api/v1/providers/openstack/securitygroups",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackSecurityGroupsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackSecurityGroupsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackSecurityGroupsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOpenstackSecurityGroupsNoCredentials Lists security groups from openstack
*/
func (a *Client) ListOpenstackSecurityGroupsNoCredentials(params *ListOpenstackSecurityGroupsNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSecurityGroupsNoCredentialsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackSecurityGroupsNoCredentialsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackSecurityGroupsNoCredentials",
Method: "GET",
PathPattern: "/api/v1/projects/{project_id}/dc/{dc}/clusters/{cluster_id}/providers/openstack/securitygroups",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackSecurityGroupsNoCredentialsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackSecurityGroupsNoCredentialsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackSecurityGroupsNoCredentialsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOpenstackSizes Lists sizes from openstack
*/
func (a *Client) ListOpenstackSizes(params *ListOpenstackSizesParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSizesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackSizesParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackSizes",
Method: "GET",
PathPattern: "/api/v1/providers/openstack/sizes",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackSizesReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackSizesOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackSizesDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOpenstackSizesNoCredentials Lists sizes from openstack
*/
func (a *Client) ListOpenstackSizesNoCredentials(params *ListOpenstackSizesNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSizesNoCredentialsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackSizesNoCredentialsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackSizesNoCredentials",
Method: "GET",
PathPattern: "/api/v1/projects/{project_id}/dc/{dc}/clusters/{cluster_id}/providers/openstack/sizes",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackSizesNoCredentialsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackSizesNoCredentialsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackSizesNoCredentialsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOpenstackSubnets Lists subnets from openstack
*/
func (a *Client) ListOpenstackSubnets(params *ListOpenstackSubnetsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSubnetsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackSubnetsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackSubnets",
Method: "GET",
PathPattern: "/api/v1/providers/openstack/subnets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackSubnetsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackSubnetsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackSubnetsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOpenstackSubnetsNoCredentials Lists subnets from openstack
*/
func (a *Client) ListOpenstackSubnetsNoCredentials(params *ListOpenstackSubnetsNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackSubnetsNoCredentialsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackSubnetsNoCredentialsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackSubnetsNoCredentials",
Method: "GET",
PathPattern: "/api/v1/projects/{project_id}/dc/{dc}/clusters/{cluster_id}/providers/openstack/subnets",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackSubnetsNoCredentialsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackSubnetsNoCredentialsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackSubnetsNoCredentialsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOpenstackTenants Lists tenants from openstack
*/
func (a *Client) ListOpenstackTenants(params *ListOpenstackTenantsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackTenantsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackTenantsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackTenants",
Method: "GET",
PathPattern: "/api/v1/providers/openstack/tenants",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackTenantsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackTenantsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackTenantsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
/*
ListOpenstackTenantsNoCredentials Lists tenants from openstack
*/
func (a *Client) ListOpenstackTenantsNoCredentials(params *ListOpenstackTenantsNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter) (*ListOpenstackTenantsNoCredentialsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListOpenstackTenantsNoCredentialsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listOpenstackTenantsNoCredentials",
Method: "GET",
PathPattern: "/api/v1/projects/{project_id}/dc/{dc}/clusters/{cluster_id}/providers/openstack/tenants",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &ListOpenstackTenantsNoCredentialsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListOpenstackTenantsNoCredentialsOK)
if ok {
return success, nil
}
// unexpected success response
unexpectedSuccess := result.(*ListOpenstackTenantsNoCredentialsDefault)
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}