...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package index
20
21
22
23
24 import (
25 "fmt"
26 "io"
27
28 "github.com/go-openapi/runtime"
29 "github.com/go-openapi/strfmt"
30
31 "github.com/sigstore/rekor/pkg/generated/models"
32 )
33
34
35 type SearchIndexReader struct {
36 formats strfmt.Registry
37 }
38
39
40 func (o *SearchIndexReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
41 switch response.Code() {
42 case 200:
43 result := NewSearchIndexOK()
44 if err := result.readResponse(response, consumer, o.formats); err != nil {
45 return nil, err
46 }
47 return result, nil
48 case 400:
49 result := NewSearchIndexBadRequest()
50 if err := result.readResponse(response, consumer, o.formats); err != nil {
51 return nil, err
52 }
53 return nil, result
54 default:
55 result := NewSearchIndexDefault(response.Code())
56 if err := result.readResponse(response, consumer, o.formats); err != nil {
57 return nil, err
58 }
59 if response.Code()/100 == 2 {
60 return result, nil
61 }
62 return nil, result
63 }
64 }
65
66
67 func NewSearchIndexOK() *SearchIndexOK {
68 return &SearchIndexOK{}
69 }
70
71
76 type SearchIndexOK struct {
77 Payload []string
78 }
79
80
81 func (o *SearchIndexOK) IsSuccess() bool {
82 return true
83 }
84
85
86 func (o *SearchIndexOK) IsRedirect() bool {
87 return false
88 }
89
90
91 func (o *SearchIndexOK) IsClientError() bool {
92 return false
93 }
94
95
96 func (o *SearchIndexOK) IsServerError() bool {
97 return false
98 }
99
100
101 func (o *SearchIndexOK) IsCode(code int) bool {
102 return code == 200
103 }
104
105
106 func (o *SearchIndexOK) Code() int {
107 return 200
108 }
109
110 func (o *SearchIndexOK) Error() string {
111 return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndexOK %+v", 200, o.Payload)
112 }
113
114 func (o *SearchIndexOK) String() string {
115 return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndexOK %+v", 200, o.Payload)
116 }
117
118 func (o *SearchIndexOK) GetPayload() []string {
119 return o.Payload
120 }
121
122 func (o *SearchIndexOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
123
124
125 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
126 return err
127 }
128
129 return nil
130 }
131
132
133 func NewSearchIndexBadRequest() *SearchIndexBadRequest {
134 return &SearchIndexBadRequest{}
135 }
136
137
142 type SearchIndexBadRequest struct {
143 Payload *models.Error
144 }
145
146
147 func (o *SearchIndexBadRequest) IsSuccess() bool {
148 return false
149 }
150
151
152 func (o *SearchIndexBadRequest) IsRedirect() bool {
153 return false
154 }
155
156
157 func (o *SearchIndexBadRequest) IsClientError() bool {
158 return true
159 }
160
161
162 func (o *SearchIndexBadRequest) IsServerError() bool {
163 return false
164 }
165
166
167 func (o *SearchIndexBadRequest) IsCode(code int) bool {
168 return code == 400
169 }
170
171
172 func (o *SearchIndexBadRequest) Code() int {
173 return 400
174 }
175
176 func (o *SearchIndexBadRequest) Error() string {
177 return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndexBadRequest %+v", 400, o.Payload)
178 }
179
180 func (o *SearchIndexBadRequest) String() string {
181 return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndexBadRequest %+v", 400, o.Payload)
182 }
183
184 func (o *SearchIndexBadRequest) GetPayload() *models.Error {
185 return o.Payload
186 }
187
188 func (o *SearchIndexBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
189
190 o.Payload = new(models.Error)
191
192
193 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
194 return err
195 }
196
197 return nil
198 }
199
200
201 func NewSearchIndexDefault(code int) *SearchIndexDefault {
202 return &SearchIndexDefault{
203 _statusCode: code,
204 }
205 }
206
207
212 type SearchIndexDefault struct {
213 _statusCode int
214
215 Payload *models.Error
216 }
217
218
219 func (o *SearchIndexDefault) IsSuccess() bool {
220 return o._statusCode/100 == 2
221 }
222
223
224 func (o *SearchIndexDefault) IsRedirect() bool {
225 return o._statusCode/100 == 3
226 }
227
228
229 func (o *SearchIndexDefault) IsClientError() bool {
230 return o._statusCode/100 == 4
231 }
232
233
234 func (o *SearchIndexDefault) IsServerError() bool {
235 return o._statusCode/100 == 5
236 }
237
238
239 func (o *SearchIndexDefault) IsCode(code int) bool {
240 return o._statusCode == code
241 }
242
243
244 func (o *SearchIndexDefault) Code() int {
245 return o._statusCode
246 }
247
248 func (o *SearchIndexDefault) Error() string {
249 return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndex default %+v", o._statusCode, o.Payload)
250 }
251
252 func (o *SearchIndexDefault) String() string {
253 return fmt.Sprintf("[POST /api/v1/index/retrieve][%d] searchIndex default %+v", o._statusCode, o.Payload)
254 }
255
256 func (o *SearchIndexDefault) GetPayload() *models.Error {
257 return o.Payload
258 }
259
260 func (o *SearchIndexDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
261
262 o.Payload = new(models.Error)
263
264
265 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
266 return err
267 }
268
269 return nil
270 }
271
View as plain text