...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package alertgroup
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 NewGetAlertGroupsParams() *GetAlertGroupsParams {
41 return &GetAlertGroupsParams{
42 timeout: cr.DefaultTimeout,
43 }
44 }
45
46
47
48 func NewGetAlertGroupsParamsWithTimeout(timeout time.Duration) *GetAlertGroupsParams {
49 return &GetAlertGroupsParams{
50 timeout: timeout,
51 }
52 }
53
54
55
56 func NewGetAlertGroupsParamsWithContext(ctx context.Context) *GetAlertGroupsParams {
57 return &GetAlertGroupsParams{
58 Context: ctx,
59 }
60 }
61
62
63
64 func NewGetAlertGroupsParamsWithHTTPClient(client *http.Client) *GetAlertGroupsParams {
65 return &GetAlertGroupsParams{
66 HTTPClient: client,
67 }
68 }
69
70
77 type GetAlertGroupsParams struct {
78
79
85 Active *bool
86
87
91 Filter []string
92
93
99 Inhibited *bool
100
101
105 Receiver *string
106
107
113 Silenced *bool
114
115 timeout time.Duration
116 Context context.Context
117 HTTPClient *http.Client
118 }
119
120
121
122
123 func (o *GetAlertGroupsParams) WithDefaults() *GetAlertGroupsParams {
124 o.SetDefaults()
125 return o
126 }
127
128
129
130
131 func (o *GetAlertGroupsParams) SetDefaults() {
132 var (
133 activeDefault = bool(true)
134
135 inhibitedDefault = bool(true)
136
137 silencedDefault = bool(true)
138 )
139
140 val := GetAlertGroupsParams{
141 Active: &activeDefault,
142 Inhibited: &inhibitedDefault,
143 Silenced: &silencedDefault,
144 }
145
146 val.timeout = o.timeout
147 val.Context = o.Context
148 val.HTTPClient = o.HTTPClient
149 *o = val
150 }
151
152
153 func (o *GetAlertGroupsParams) WithTimeout(timeout time.Duration) *GetAlertGroupsParams {
154 o.SetTimeout(timeout)
155 return o
156 }
157
158
159 func (o *GetAlertGroupsParams) SetTimeout(timeout time.Duration) {
160 o.timeout = timeout
161 }
162
163
164 func (o *GetAlertGroupsParams) WithContext(ctx context.Context) *GetAlertGroupsParams {
165 o.SetContext(ctx)
166 return o
167 }
168
169
170 func (o *GetAlertGroupsParams) SetContext(ctx context.Context) {
171 o.Context = ctx
172 }
173
174
175 func (o *GetAlertGroupsParams) WithHTTPClient(client *http.Client) *GetAlertGroupsParams {
176 o.SetHTTPClient(client)
177 return o
178 }
179
180
181 func (o *GetAlertGroupsParams) SetHTTPClient(client *http.Client) {
182 o.HTTPClient = client
183 }
184
185
186 func (o *GetAlertGroupsParams) WithActive(active *bool) *GetAlertGroupsParams {
187 o.SetActive(active)
188 return o
189 }
190
191
192 func (o *GetAlertGroupsParams) SetActive(active *bool) {
193 o.Active = active
194 }
195
196
197 func (o *GetAlertGroupsParams) WithFilter(filter []string) *GetAlertGroupsParams {
198 o.SetFilter(filter)
199 return o
200 }
201
202
203 func (o *GetAlertGroupsParams) SetFilter(filter []string) {
204 o.Filter = filter
205 }
206
207
208 func (o *GetAlertGroupsParams) WithInhibited(inhibited *bool) *GetAlertGroupsParams {
209 o.SetInhibited(inhibited)
210 return o
211 }
212
213
214 func (o *GetAlertGroupsParams) SetInhibited(inhibited *bool) {
215 o.Inhibited = inhibited
216 }
217
218
219 func (o *GetAlertGroupsParams) WithReceiver(receiver *string) *GetAlertGroupsParams {
220 o.SetReceiver(receiver)
221 return o
222 }
223
224
225 func (o *GetAlertGroupsParams) SetReceiver(receiver *string) {
226 o.Receiver = receiver
227 }
228
229
230 func (o *GetAlertGroupsParams) WithSilenced(silenced *bool) *GetAlertGroupsParams {
231 o.SetSilenced(silenced)
232 return o
233 }
234
235
236 func (o *GetAlertGroupsParams) SetSilenced(silenced *bool) {
237 o.Silenced = silenced
238 }
239
240
241 func (o *GetAlertGroupsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
242
243 if err := r.SetTimeout(o.timeout); err != nil {
244 return err
245 }
246 var res []error
247
248 if o.Active != nil {
249
250
251 var qrActive bool
252
253 if o.Active != nil {
254 qrActive = *o.Active
255 }
256 qActive := swag.FormatBool(qrActive)
257 if qActive != "" {
258
259 if err := r.SetQueryParam("active", qActive); err != nil {
260 return err
261 }
262 }
263 }
264
265 if o.Filter != nil {
266
267
268 joinedFilter := o.bindParamFilter(reg)
269
270
271 if err := r.SetQueryParam("filter", joinedFilter...); err != nil {
272 return err
273 }
274 }
275
276 if o.Inhibited != nil {
277
278
279 var qrInhibited bool
280
281 if o.Inhibited != nil {
282 qrInhibited = *o.Inhibited
283 }
284 qInhibited := swag.FormatBool(qrInhibited)
285 if qInhibited != "" {
286
287 if err := r.SetQueryParam("inhibited", qInhibited); err != nil {
288 return err
289 }
290 }
291 }
292
293 if o.Receiver != nil {
294
295
296 var qrReceiver string
297
298 if o.Receiver != nil {
299 qrReceiver = *o.Receiver
300 }
301 qReceiver := qrReceiver
302 if qReceiver != "" {
303
304 if err := r.SetQueryParam("receiver", qReceiver); err != nil {
305 return err
306 }
307 }
308 }
309
310 if o.Silenced != nil {
311
312
313 var qrSilenced bool
314
315 if o.Silenced != nil {
316 qrSilenced = *o.Silenced
317 }
318 qSilenced := swag.FormatBool(qrSilenced)
319 if qSilenced != "" {
320
321 if err := r.SetQueryParam("silenced", qSilenced); err != nil {
322 return err
323 }
324 }
325 }
326
327 if len(res) > 0 {
328 return errors.CompositeValidationError(res...)
329 }
330 return nil
331 }
332
333
334 func (o *GetAlertGroupsParams) bindParamFilter(formats strfmt.Registry) []string {
335 filterIR := o.Filter
336
337 var filterIC []string
338 for _, filterIIR := range filterIR {
339
340 filterIIV := filterIIR
341 filterIC = append(filterIC, filterIIV)
342 }
343
344
345 filterIS := swag.JoinByFormat(filterIC, "multi")
346
347 return filterIS
348 }
349
View as plain text