...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package tlog
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 GetLogProofReader struct {
36 formats strfmt.Registry
37 }
38
39
40 func (o *GetLogProofReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
41 switch response.Code() {
42 case 200:
43 result := NewGetLogProofOK()
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 := NewGetLogProofBadRequest()
50 if err := result.readResponse(response, consumer, o.formats); err != nil {
51 return nil, err
52 }
53 return nil, result
54 default:
55 result := NewGetLogProofDefault(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 NewGetLogProofOK() *GetLogProofOK {
68 return &GetLogProofOK{}
69 }
70
71
76 type GetLogProofOK struct {
77 Payload *models.ConsistencyProof
78 }
79
80
81 func (o *GetLogProofOK) IsSuccess() bool {
82 return true
83 }
84
85
86 func (o *GetLogProofOK) IsRedirect() bool {
87 return false
88 }
89
90
91 func (o *GetLogProofOK) IsClientError() bool {
92 return false
93 }
94
95
96 func (o *GetLogProofOK) IsServerError() bool {
97 return false
98 }
99
100
101 func (o *GetLogProofOK) IsCode(code int) bool {
102 return code == 200
103 }
104
105
106 func (o *GetLogProofOK) Code() int {
107 return 200
108 }
109
110 func (o *GetLogProofOK) Error() string {
111 return fmt.Sprintf("[GET /api/v1/log/proof][%d] getLogProofOK %+v", 200, o.Payload)
112 }
113
114 func (o *GetLogProofOK) String() string {
115 return fmt.Sprintf("[GET /api/v1/log/proof][%d] getLogProofOK %+v", 200, o.Payload)
116 }
117
118 func (o *GetLogProofOK) GetPayload() *models.ConsistencyProof {
119 return o.Payload
120 }
121
122 func (o *GetLogProofOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
123
124 o.Payload = new(models.ConsistencyProof)
125
126
127 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
128 return err
129 }
130
131 return nil
132 }
133
134
135 func NewGetLogProofBadRequest() *GetLogProofBadRequest {
136 return &GetLogProofBadRequest{}
137 }
138
139
144 type GetLogProofBadRequest struct {
145 Payload *models.Error
146 }
147
148
149 func (o *GetLogProofBadRequest) IsSuccess() bool {
150 return false
151 }
152
153
154 func (o *GetLogProofBadRequest) IsRedirect() bool {
155 return false
156 }
157
158
159 func (o *GetLogProofBadRequest) IsClientError() bool {
160 return true
161 }
162
163
164 func (o *GetLogProofBadRequest) IsServerError() bool {
165 return false
166 }
167
168
169 func (o *GetLogProofBadRequest) IsCode(code int) bool {
170 return code == 400
171 }
172
173
174 func (o *GetLogProofBadRequest) Code() int {
175 return 400
176 }
177
178 func (o *GetLogProofBadRequest) Error() string {
179 return fmt.Sprintf("[GET /api/v1/log/proof][%d] getLogProofBadRequest %+v", 400, o.Payload)
180 }
181
182 func (o *GetLogProofBadRequest) String() string {
183 return fmt.Sprintf("[GET /api/v1/log/proof][%d] getLogProofBadRequest %+v", 400, o.Payload)
184 }
185
186 func (o *GetLogProofBadRequest) GetPayload() *models.Error {
187 return o.Payload
188 }
189
190 func (o *GetLogProofBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
191
192 o.Payload = new(models.Error)
193
194
195 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
196 return err
197 }
198
199 return nil
200 }
201
202
203 func NewGetLogProofDefault(code int) *GetLogProofDefault {
204 return &GetLogProofDefault{
205 _statusCode: code,
206 }
207 }
208
209
214 type GetLogProofDefault struct {
215 _statusCode int
216
217 Payload *models.Error
218 }
219
220
221 func (o *GetLogProofDefault) IsSuccess() bool {
222 return o._statusCode/100 == 2
223 }
224
225
226 func (o *GetLogProofDefault) IsRedirect() bool {
227 return o._statusCode/100 == 3
228 }
229
230
231 func (o *GetLogProofDefault) IsClientError() bool {
232 return o._statusCode/100 == 4
233 }
234
235
236 func (o *GetLogProofDefault) IsServerError() bool {
237 return o._statusCode/100 == 5
238 }
239
240
241 func (o *GetLogProofDefault) IsCode(code int) bool {
242 return o._statusCode == code
243 }
244
245
246 func (o *GetLogProofDefault) Code() int {
247 return o._statusCode
248 }
249
250 func (o *GetLogProofDefault) Error() string {
251 return fmt.Sprintf("[GET /api/v1/log/proof][%d] getLogProof default %+v", o._statusCode, o.Payload)
252 }
253
254 func (o *GetLogProofDefault) String() string {
255 return fmt.Sprintf("[GET /api/v1/log/proof][%d] getLogProof default %+v", o._statusCode, o.Payload)
256 }
257
258 func (o *GetLogProofDefault) GetPayload() *models.Error {
259 return o.Payload
260 }
261
262 func (o *GetLogProofDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
263
264 o.Payload = new(models.Error)
265
266
267 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
268 return err
269 }
270
271 return nil
272 }
273
View as plain text