...
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 "fmt"
24 "io"
25
26 "github.com/go-openapi/runtime"
27 "github.com/go-openapi/strfmt"
28
29 "github.com/prometheus/alertmanager/api/v2/models"
30 )
31
32
33 type GetAlertGroupsReader struct {
34 formats strfmt.Registry
35 }
36
37
38 func (o *GetAlertGroupsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
39 switch response.Code() {
40 case 200:
41 result := NewGetAlertGroupsOK()
42 if err := result.readResponse(response, consumer, o.formats); err != nil {
43 return nil, err
44 }
45 return result, nil
46 case 400:
47 result := NewGetAlertGroupsBadRequest()
48 if err := result.readResponse(response, consumer, o.formats); err != nil {
49 return nil, err
50 }
51 return nil, result
52 case 500:
53 result := NewGetAlertGroupsInternalServerError()
54 if err := result.readResponse(response, consumer, o.formats); err != nil {
55 return nil, err
56 }
57 return nil, result
58 default:
59 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
60 }
61 }
62
63
64 func NewGetAlertGroupsOK() *GetAlertGroupsOK {
65 return &GetAlertGroupsOK{}
66 }
67
68
73 type GetAlertGroupsOK struct {
74 Payload models.AlertGroups
75 }
76
77
78 func (o *GetAlertGroupsOK) IsSuccess() bool {
79 return true
80 }
81
82
83 func (o *GetAlertGroupsOK) IsRedirect() bool {
84 return false
85 }
86
87
88 func (o *GetAlertGroupsOK) IsClientError() bool {
89 return false
90 }
91
92
93 func (o *GetAlertGroupsOK) IsServerError() bool {
94 return false
95 }
96
97
98 func (o *GetAlertGroupsOK) IsCode(code int) bool {
99 return code == 200
100 }
101
102 func (o *GetAlertGroupsOK) Error() string {
103 return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload)
104 }
105
106 func (o *GetAlertGroupsOK) String() string {
107 return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsOK %+v", 200, o.Payload)
108 }
109
110 func (o *GetAlertGroupsOK) GetPayload() models.AlertGroups {
111 return o.Payload
112 }
113
114 func (o *GetAlertGroupsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
115
116
117 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
118 return err
119 }
120
121 return nil
122 }
123
124
125 func NewGetAlertGroupsBadRequest() *GetAlertGroupsBadRequest {
126 return &GetAlertGroupsBadRequest{}
127 }
128
129
134 type GetAlertGroupsBadRequest struct {
135 Payload string
136 }
137
138
139 func (o *GetAlertGroupsBadRequest) IsSuccess() bool {
140 return false
141 }
142
143
144 func (o *GetAlertGroupsBadRequest) IsRedirect() bool {
145 return false
146 }
147
148
149 func (o *GetAlertGroupsBadRequest) IsClientError() bool {
150 return true
151 }
152
153
154 func (o *GetAlertGroupsBadRequest) IsServerError() bool {
155 return false
156 }
157
158
159 func (o *GetAlertGroupsBadRequest) IsCode(code int) bool {
160 return code == 400
161 }
162
163 func (o *GetAlertGroupsBadRequest) Error() string {
164 return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload)
165 }
166
167 func (o *GetAlertGroupsBadRequest) String() string {
168 return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsBadRequest %+v", 400, o.Payload)
169 }
170
171 func (o *GetAlertGroupsBadRequest) GetPayload() string {
172 return o.Payload
173 }
174
175 func (o *GetAlertGroupsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
176
177
178 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
179 return err
180 }
181
182 return nil
183 }
184
185
186 func NewGetAlertGroupsInternalServerError() *GetAlertGroupsInternalServerError {
187 return &GetAlertGroupsInternalServerError{}
188 }
189
190
195 type GetAlertGroupsInternalServerError struct {
196 Payload string
197 }
198
199
200 func (o *GetAlertGroupsInternalServerError) IsSuccess() bool {
201 return false
202 }
203
204
205 func (o *GetAlertGroupsInternalServerError) IsRedirect() bool {
206 return false
207 }
208
209
210 func (o *GetAlertGroupsInternalServerError) IsClientError() bool {
211 return false
212 }
213
214
215 func (o *GetAlertGroupsInternalServerError) IsServerError() bool {
216 return true
217 }
218
219
220 func (o *GetAlertGroupsInternalServerError) IsCode(code int) bool {
221 return code == 500
222 }
223
224 func (o *GetAlertGroupsInternalServerError) Error() string {
225 return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload)
226 }
227
228 func (o *GetAlertGroupsInternalServerError) String() string {
229 return fmt.Sprintf("[GET /alerts/groups][%d] getAlertGroupsInternalServerError %+v", 500, o.Payload)
230 }
231
232 func (o *GetAlertGroupsInternalServerError) GetPayload() string {
233 return o.Payload
234 }
235
236 func (o *GetAlertGroupsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
237
238
239 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
240 return err
241 }
242
243 return nil
244 }
245
View as plain text