-
Notifications
You must be signed in to change notification settings - Fork 5
/
list_cluster_services_parameters.go
624 lines (479 loc) · 17.7 KB
/
list_cluster_services_parameters.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
// Code generated by go-swagger; DO NOT EDIT.
package services
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewListClusterServicesParams creates a new ListClusterServicesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewListClusterServicesParams() *ListClusterServicesParams {
return &ListClusterServicesParams{
timeout: cr.DefaultTimeout,
}
}
// NewListClusterServicesParamsWithTimeout creates a new ListClusterServicesParams object
// with the ability to set a timeout on a request.
func NewListClusterServicesParamsWithTimeout(timeout time.Duration) *ListClusterServicesParams {
return &ListClusterServicesParams{
timeout: timeout,
}
}
// NewListClusterServicesParamsWithContext creates a new ListClusterServicesParams object
// with the ability to set a context for a request.
func NewListClusterServicesParamsWithContext(ctx context.Context) *ListClusterServicesParams {
return &ListClusterServicesParams{
Context: ctx,
}
}
// NewListClusterServicesParamsWithHTTPClient creates a new ListClusterServicesParams object
// with the ability to set a custom HTTPClient for a request.
func NewListClusterServicesParamsWithHTTPClient(client *http.Client) *ListClusterServicesParams {
return &ListClusterServicesParams{
HTTPClient: client,
}
}
/*
ListClusterServicesParams contains all the parameters to send to the API endpoint
for the list cluster services operation.
Typically these are written to a http.Request.
*/
type ListClusterServicesParams struct {
/* ClusterResourceName.
Cluster resource name will be of the form `consul/project/<project_id>/cluster/<cluster_id>`
*/
ClusterResourceName string
/* ExternalSources.
Query param filter: `external_sources`. Returns a service when service's external sources overlap with the external sources specified.
*/
ExternalSources []string
/* InMesh.
Query param filter: whether the service is in the service mesh or not. Possible values: `true` or `false`.
*/
InMesh *bool
/* Kind.
Query param filter: `kind` of the service. This can be combination of `typical`, `connect-proxy`, `destination`, `api-gateway`, `ingress-gateway`, `terminating-gateway`, `mesh-gateway`.
*/
Kind []string
/* MtlsMode.
Query param filter: mTLS mode of the service. Possible value: `permissive`, `strict`.
*/
MtlsMode []string
/* Namespace.
Query param filter: `namespace` of the service.
*/
Namespace *string
/* OrderBy.
Sorts the services based on a field. Allowed fields: `name`, `health`. The value needs to be of the format <{name/health} {asc/desc}> For example: `name asc`, `health desc`.
*/
OrderBy []string
/* PaginationNextPageToken.
Specifies a page token to use to retrieve the next page. Set this parameter to the
`next_page_token` returned by previous list requests to get the next page of
results. If set, `previous_page_token` must not be set.
*/
PaginationNextPageToken *string
/* PaginationPageSize.
The maximum number of results per page to return. If the number
of available results is larger than `page_size`, a `next_page_token` is
returned, which you can use to get the next page of results in subsequent
requests. A value of zero causes `page_size` to be defaulted.
Format: int64
*/
PaginationPageSize *int64
/* PaginationPreviousPageToken.
Specifies a page token to use to retrieve the previous page. Set this parameter to
the `previous_page_token` returned by previous list requests to get the
previous page of results. If set, `next_page_token` must not be set.
*/
PaginationPreviousPageToken *string
/* Partition.
Query param filter: `partition` of the service.
*/
Partition *string
/* Query.
Search query to filter by. Searches across service `name`, `cluster_id`, `partition`, `namespace`, `sameness_group`, `tags`
*/
Query *string
/* Status.
Query param filter: `status` of the service. This can be combination of `passing`, `warning`, `critical`, `none`.
*/
Status []string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list cluster services params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListClusterServicesParams) WithDefaults() *ListClusterServicesParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list cluster services params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListClusterServicesParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the list cluster services params
func (o *ListClusterServicesParams) WithTimeout(timeout time.Duration) *ListClusterServicesParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list cluster services params
func (o *ListClusterServicesParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list cluster services params
func (o *ListClusterServicesParams) WithContext(ctx context.Context) *ListClusterServicesParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list cluster services params
func (o *ListClusterServicesParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list cluster services params
func (o *ListClusterServicesParams) WithHTTPClient(client *http.Client) *ListClusterServicesParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list cluster services params
func (o *ListClusterServicesParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithClusterResourceName adds the clusterResourceName to the list cluster services params
func (o *ListClusterServicesParams) WithClusterResourceName(clusterResourceName string) *ListClusterServicesParams {
o.SetClusterResourceName(clusterResourceName)
return o
}
// SetClusterResourceName adds the clusterResourceName to the list cluster services params
func (o *ListClusterServicesParams) SetClusterResourceName(clusterResourceName string) {
o.ClusterResourceName = clusterResourceName
}
// WithExternalSources adds the externalSources to the list cluster services params
func (o *ListClusterServicesParams) WithExternalSources(externalSources []string) *ListClusterServicesParams {
o.SetExternalSources(externalSources)
return o
}
// SetExternalSources adds the externalSources to the list cluster services params
func (o *ListClusterServicesParams) SetExternalSources(externalSources []string) {
o.ExternalSources = externalSources
}
// WithInMesh adds the inMesh to the list cluster services params
func (o *ListClusterServicesParams) WithInMesh(inMesh *bool) *ListClusterServicesParams {
o.SetInMesh(inMesh)
return o
}
// SetInMesh adds the inMesh to the list cluster services params
func (o *ListClusterServicesParams) SetInMesh(inMesh *bool) {
o.InMesh = inMesh
}
// WithKind adds the kind to the list cluster services params
func (o *ListClusterServicesParams) WithKind(kind []string) *ListClusterServicesParams {
o.SetKind(kind)
return o
}
// SetKind adds the kind to the list cluster services params
func (o *ListClusterServicesParams) SetKind(kind []string) {
o.Kind = kind
}
// WithMtlsMode adds the mtlsMode to the list cluster services params
func (o *ListClusterServicesParams) WithMtlsMode(mtlsMode []string) *ListClusterServicesParams {
o.SetMtlsMode(mtlsMode)
return o
}
// SetMtlsMode adds the mtlsMode to the list cluster services params
func (o *ListClusterServicesParams) SetMtlsMode(mtlsMode []string) {
o.MtlsMode = mtlsMode
}
// WithNamespace adds the namespace to the list cluster services params
func (o *ListClusterServicesParams) WithNamespace(namespace *string) *ListClusterServicesParams {
o.SetNamespace(namespace)
return o
}
// SetNamespace adds the namespace to the list cluster services params
func (o *ListClusterServicesParams) SetNamespace(namespace *string) {
o.Namespace = namespace
}
// WithOrderBy adds the orderBy to the list cluster services params
func (o *ListClusterServicesParams) WithOrderBy(orderBy []string) *ListClusterServicesParams {
o.SetOrderBy(orderBy)
return o
}
// SetOrderBy adds the orderBy to the list cluster services params
func (o *ListClusterServicesParams) SetOrderBy(orderBy []string) {
o.OrderBy = orderBy
}
// WithPaginationNextPageToken adds the paginationNextPageToken to the list cluster services params
func (o *ListClusterServicesParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ListClusterServicesParams {
o.SetPaginationNextPageToken(paginationNextPageToken)
return o
}
// SetPaginationNextPageToken adds the paginationNextPageToken to the list cluster services params
func (o *ListClusterServicesParams) SetPaginationNextPageToken(paginationNextPageToken *string) {
o.PaginationNextPageToken = paginationNextPageToken
}
// WithPaginationPageSize adds the paginationPageSize to the list cluster services params
func (o *ListClusterServicesParams) WithPaginationPageSize(paginationPageSize *int64) *ListClusterServicesParams {
o.SetPaginationPageSize(paginationPageSize)
return o
}
// SetPaginationPageSize adds the paginationPageSize to the list cluster services params
func (o *ListClusterServicesParams) SetPaginationPageSize(paginationPageSize *int64) {
o.PaginationPageSize = paginationPageSize
}
// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the list cluster services params
func (o *ListClusterServicesParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ListClusterServicesParams {
o.SetPaginationPreviousPageToken(paginationPreviousPageToken)
return o
}
// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the list cluster services params
func (o *ListClusterServicesParams) SetPaginationPreviousPageToken(paginationPreviousPageToken *string) {
o.PaginationPreviousPageToken = paginationPreviousPageToken
}
// WithPartition adds the partition to the list cluster services params
func (o *ListClusterServicesParams) WithPartition(partition *string) *ListClusterServicesParams {
o.SetPartition(partition)
return o
}
// SetPartition adds the partition to the list cluster services params
func (o *ListClusterServicesParams) SetPartition(partition *string) {
o.Partition = partition
}
// WithQuery adds the query to the list cluster services params
func (o *ListClusterServicesParams) WithQuery(query *string) *ListClusterServicesParams {
o.SetQuery(query)
return o
}
// SetQuery adds the query to the list cluster services params
func (o *ListClusterServicesParams) SetQuery(query *string) {
o.Query = query
}
// WithStatus adds the status to the list cluster services params
func (o *ListClusterServicesParams) WithStatus(status []string) *ListClusterServicesParams {
o.SetStatus(status)
return o
}
// SetStatus adds the status to the list cluster services params
func (o *ListClusterServicesParams) SetStatus(status []string) {
o.Status = status
}
// WriteToRequest writes these params to a swagger request
func (o *ListClusterServicesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param cluster_resource_name
if err := r.SetPathParam("cluster_resource_name", o.ClusterResourceName); err != nil {
return err
}
if o.ExternalSources != nil {
// binding items for external_sources
joinedExternalSources := o.bindParamExternalSources(reg)
// query array param external_sources
if err := r.SetQueryParam("external_sources", joinedExternalSources...); err != nil {
return err
}
}
if o.InMesh != nil {
// query param in_mesh
var qrInMesh bool
if o.InMesh != nil {
qrInMesh = *o.InMesh
}
qInMesh := swag.FormatBool(qrInMesh)
if qInMesh != "" {
if err := r.SetQueryParam("in_mesh", qInMesh); err != nil {
return err
}
}
}
if o.Kind != nil {
// binding items for kind
joinedKind := o.bindParamKind(reg)
// query array param kind
if err := r.SetQueryParam("kind", joinedKind...); err != nil {
return err
}
}
if o.MtlsMode != nil {
// binding items for mtls_mode
joinedMtlsMode := o.bindParamMtlsMode(reg)
// query array param mtls_mode
if err := r.SetQueryParam("mtls_mode", joinedMtlsMode...); err != nil {
return err
}
}
if o.Namespace != nil {
// query param namespace
var qrNamespace string
if o.Namespace != nil {
qrNamespace = *o.Namespace
}
qNamespace := qrNamespace
if qNamespace != "" {
if err := r.SetQueryParam("namespace", qNamespace); err != nil {
return err
}
}
}
if o.OrderBy != nil {
// binding items for order_by
joinedOrderBy := o.bindParamOrderBy(reg)
// query array param order_by
if err := r.SetQueryParam("order_by", joinedOrderBy...); err != nil {
return err
}
}
if o.PaginationNextPageToken != nil {
// query param pagination.next_page_token
var qrPaginationNextPageToken string
if o.PaginationNextPageToken != nil {
qrPaginationNextPageToken = *o.PaginationNextPageToken
}
qPaginationNextPageToken := qrPaginationNextPageToken
if qPaginationNextPageToken != "" {
if err := r.SetQueryParam("pagination.next_page_token", qPaginationNextPageToken); err != nil {
return err
}
}
}
if o.PaginationPageSize != nil {
// query param pagination.page_size
var qrPaginationPageSize int64
if o.PaginationPageSize != nil {
qrPaginationPageSize = *o.PaginationPageSize
}
qPaginationPageSize := swag.FormatInt64(qrPaginationPageSize)
if qPaginationPageSize != "" {
if err := r.SetQueryParam("pagination.page_size", qPaginationPageSize); err != nil {
return err
}
}
}
if o.PaginationPreviousPageToken != nil {
// query param pagination.previous_page_token
var qrPaginationPreviousPageToken string
if o.PaginationPreviousPageToken != nil {
qrPaginationPreviousPageToken = *o.PaginationPreviousPageToken
}
qPaginationPreviousPageToken := qrPaginationPreviousPageToken
if qPaginationPreviousPageToken != "" {
if err := r.SetQueryParam("pagination.previous_page_token", qPaginationPreviousPageToken); err != nil {
return err
}
}
}
if o.Partition != nil {
// query param partition
var qrPartition string
if o.Partition != nil {
qrPartition = *o.Partition
}
qPartition := qrPartition
if qPartition != "" {
if err := r.SetQueryParam("partition", qPartition); err != nil {
return err
}
}
}
if o.Query != nil {
// query param query
var qrQuery string
if o.Query != nil {
qrQuery = *o.Query
}
qQuery := qrQuery
if qQuery != "" {
if err := r.SetQueryParam("query", qQuery); err != nil {
return err
}
}
}
if o.Status != nil {
// binding items for status
joinedStatus := o.bindParamStatus(reg)
// query array param status
if err := r.SetQueryParam("status", joinedStatus...); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindParamListClusterServices binds the parameter external_sources
func (o *ListClusterServicesParams) bindParamExternalSources(formats strfmt.Registry) []string {
externalSourcesIR := o.ExternalSources
var externalSourcesIC []string
for _, externalSourcesIIR := range externalSourcesIR { // explode []string
externalSourcesIIV := externalSourcesIIR // string as string
externalSourcesIC = append(externalSourcesIC, externalSourcesIIV)
}
// items.CollectionFormat: "multi"
externalSourcesIS := swag.JoinByFormat(externalSourcesIC, "multi")
return externalSourcesIS
}
// bindParamListClusterServices binds the parameter kind
func (o *ListClusterServicesParams) bindParamKind(formats strfmt.Registry) []string {
kindIR := o.Kind
var kindIC []string
for _, kindIIR := range kindIR { // explode []string
kindIIV := kindIIR // string as string
kindIC = append(kindIC, kindIIV)
}
// items.CollectionFormat: "multi"
kindIS := swag.JoinByFormat(kindIC, "multi")
return kindIS
}
// bindParamListClusterServices binds the parameter mtls_mode
func (o *ListClusterServicesParams) bindParamMtlsMode(formats strfmt.Registry) []string {
mtlsModeIR := o.MtlsMode
var mtlsModeIC []string
for _, mtlsModeIIR := range mtlsModeIR { // explode []string
mtlsModeIIV := mtlsModeIIR // string as string
mtlsModeIC = append(mtlsModeIC, mtlsModeIIV)
}
// items.CollectionFormat: "multi"
mtlsModeIS := swag.JoinByFormat(mtlsModeIC, "multi")
return mtlsModeIS
}
// bindParamListClusterServices binds the parameter order_by
func (o *ListClusterServicesParams) bindParamOrderBy(formats strfmt.Registry) []string {
orderByIR := o.OrderBy
var orderByIC []string
for _, orderByIIR := range orderByIR { // explode []string
orderByIIV := orderByIIR // string as string
orderByIC = append(orderByIC, orderByIIV)
}
// items.CollectionFormat: "multi"
orderByIS := swag.JoinByFormat(orderByIC, "multi")
return orderByIS
}
// bindParamListClusterServices binds the parameter status
func (o *ListClusterServicesParams) bindParamStatus(formats strfmt.Registry) []string {
statusIR := o.Status
var statusIC []string
for _, statusIIR := range statusIR { // explode []string
statusIIV := statusIIR // string as string
statusIC = append(statusIC, statusIIV)
}
// items.CollectionFormat: "multi"
statusIS := swag.JoinByFormat(statusIC, "multi")
return statusIS
}