...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package alert
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
30
31 type PostAlertsReader struct {
32 formats strfmt.Registry
33 }
34
35
36 func (o *PostAlertsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
37 switch response.Code() {
38 case 200:
39 result := NewPostAlertsOK()
40 if err := result.readResponse(response, consumer, o.formats); err != nil {
41 return nil, err
42 }
43 return result, nil
44 case 400:
45 result := NewPostAlertsBadRequest()
46 if err := result.readResponse(response, consumer, o.formats); err != nil {
47 return nil, err
48 }
49 return nil, result
50 case 500:
51 result := NewPostAlertsInternalServerError()
52 if err := result.readResponse(response, consumer, o.formats); err != nil {
53 return nil, err
54 }
55 return nil, result
56 default:
57 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
58 }
59 }
60
61
62 func NewPostAlertsOK() *PostAlertsOK {
63 return &PostAlertsOK{}
64 }
65
66
71 type PostAlertsOK struct {
72 }
73
74
75 func (o *PostAlertsOK) IsSuccess() bool {
76 return true
77 }
78
79
80 func (o *PostAlertsOK) IsRedirect() bool {
81 return false
82 }
83
84
85 func (o *PostAlertsOK) IsClientError() bool {
86 return false
87 }
88
89
90 func (o *PostAlertsOK) IsServerError() bool {
91 return false
92 }
93
94
95 func (o *PostAlertsOK) IsCode(code int) bool {
96 return code == 200
97 }
98
99 func (o *PostAlertsOK) Error() string {
100 return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200)
101 }
102
103 func (o *PostAlertsOK) String() string {
104 return fmt.Sprintf("[POST /alerts][%d] postAlertsOK ", 200)
105 }
106
107 func (o *PostAlertsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
108
109 return nil
110 }
111
112
113 func NewPostAlertsBadRequest() *PostAlertsBadRequest {
114 return &PostAlertsBadRequest{}
115 }
116
117
122 type PostAlertsBadRequest struct {
123 Payload string
124 }
125
126
127 func (o *PostAlertsBadRequest) IsSuccess() bool {
128 return false
129 }
130
131
132 func (o *PostAlertsBadRequest) IsRedirect() bool {
133 return false
134 }
135
136
137 func (o *PostAlertsBadRequest) IsClientError() bool {
138 return true
139 }
140
141
142 func (o *PostAlertsBadRequest) IsServerError() bool {
143 return false
144 }
145
146
147 func (o *PostAlertsBadRequest) IsCode(code int) bool {
148 return code == 400
149 }
150
151 func (o *PostAlertsBadRequest) Error() string {
152 return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload)
153 }
154
155 func (o *PostAlertsBadRequest) String() string {
156 return fmt.Sprintf("[POST /alerts][%d] postAlertsBadRequest %+v", 400, o.Payload)
157 }
158
159 func (o *PostAlertsBadRequest) GetPayload() string {
160 return o.Payload
161 }
162
163 func (o *PostAlertsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
164
165
166 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
167 return err
168 }
169
170 return nil
171 }
172
173
174 func NewPostAlertsInternalServerError() *PostAlertsInternalServerError {
175 return &PostAlertsInternalServerError{}
176 }
177
178
183 type PostAlertsInternalServerError struct {
184 Payload string
185 }
186
187
188 func (o *PostAlertsInternalServerError) IsSuccess() bool {
189 return false
190 }
191
192
193 func (o *PostAlertsInternalServerError) IsRedirect() bool {
194 return false
195 }
196
197
198 func (o *PostAlertsInternalServerError) IsClientError() bool {
199 return false
200 }
201
202
203 func (o *PostAlertsInternalServerError) IsServerError() bool {
204 return true
205 }
206
207
208 func (o *PostAlertsInternalServerError) IsCode(code int) bool {
209 return code == 500
210 }
211
212 func (o *PostAlertsInternalServerError) Error() string {
213 return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload)
214 }
215
216 func (o *PostAlertsInternalServerError) String() string {
217 return fmt.Sprintf("[POST /alerts][%d] postAlertsInternalServerError %+v", 500, o.Payload)
218 }
219
220 func (o *PostAlertsInternalServerError) GetPayload() string {
221 return o.Payload
222 }
223
224 func (o *PostAlertsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
225
226
227 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
228 return err
229 }
230
231 return nil
232 }
233
View as plain text