...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package silence
18
19
20
21
22 import (
23 "context"
24 "net/http"
25 "time"
26
27 "github.com/go-openapi/errors"
28 "github.com/go-openapi/runtime"
29 cr "github.com/go-openapi/runtime/client"
30 "github.com/go-openapi/strfmt"
31 "github.com/go-openapi/swag"
32 )
33
34
35
36
37
38
39
40 func NewGetSilencesParams() *GetSilencesParams {
41 return &GetSilencesParams{
42 timeout: cr.DefaultTimeout,
43 }
44 }
45
46
47
48 func NewGetSilencesParamsWithTimeout(timeout time.Duration) *GetSilencesParams {
49 return &GetSilencesParams{
50 timeout: timeout,
51 }
52 }
53
54
55
56 func NewGetSilencesParamsWithContext(ctx context.Context) *GetSilencesParams {
57 return &GetSilencesParams{
58 Context: ctx,
59 }
60 }
61
62
63
64 func NewGetSilencesParamsWithHTTPClient(client *http.Client) *GetSilencesParams {
65 return &GetSilencesParams{
66 HTTPClient: client,
67 }
68 }
69
70
77 type GetSilencesParams struct {
78
79
83 Filter []string
84
85 timeout time.Duration
86 Context context.Context
87 HTTPClient *http.Client
88 }
89
90
91
92
93 func (o *GetSilencesParams) WithDefaults() *GetSilencesParams {
94 o.SetDefaults()
95 return o
96 }
97
98
99
100
101 func (o *GetSilencesParams) SetDefaults() {
102
103 }
104
105
106 func (o *GetSilencesParams) WithTimeout(timeout time.Duration) *GetSilencesParams {
107 o.SetTimeout(timeout)
108 return o
109 }
110
111
112 func (o *GetSilencesParams) SetTimeout(timeout time.Duration) {
113 o.timeout = timeout
114 }
115
116
117 func (o *GetSilencesParams) WithContext(ctx context.Context) *GetSilencesParams {
118 o.SetContext(ctx)
119 return o
120 }
121
122
123 func (o *GetSilencesParams) SetContext(ctx context.Context) {
124 o.Context = ctx
125 }
126
127
128 func (o *GetSilencesParams) WithHTTPClient(client *http.Client) *GetSilencesParams {
129 o.SetHTTPClient(client)
130 return o
131 }
132
133
134 func (o *GetSilencesParams) SetHTTPClient(client *http.Client) {
135 o.HTTPClient = client
136 }
137
138
139 func (o *GetSilencesParams) WithFilter(filter []string) *GetSilencesParams {
140 o.SetFilter(filter)
141 return o
142 }
143
144
145 func (o *GetSilencesParams) SetFilter(filter []string) {
146 o.Filter = filter
147 }
148
149
150 func (o *GetSilencesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
151
152 if err := r.SetTimeout(o.timeout); err != nil {
153 return err
154 }
155 var res []error
156
157 if o.Filter != nil {
158
159
160 joinedFilter := o.bindParamFilter(reg)
161
162
163 if err := r.SetQueryParam("filter", joinedFilter...); err != nil {
164 return err
165 }
166 }
167
168 if len(res) > 0 {
169 return errors.CompositeValidationError(res...)
170 }
171 return nil
172 }
173
174
175 func (o *GetSilencesParams) bindParamFilter(formats strfmt.Registry) []string {
176 filterIR := o.Filter
177
178 var filterIC []string
179 for _, filterIIR := range filterIR {
180
181 filterIIV := filterIIR
182 filterIC = append(filterIC, filterIIV)
183 }
184
185
186 filterIS := swag.JoinByFormat(filterIC, "multi")
187
188 return filterIS
189 }
190
View as plain text