github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/webhook/last_trigger_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package webhook 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "fmt" 10 "io" 11 12 "github.com/go-openapi/runtime" 13 "github.com/go-openapi/strfmt" 14 15 "github.com/goharbor/go-client/pkg/sdk/v2.0/models" 16 ) 17 18 // LastTriggerReader is a Reader for the LastTrigger structure. 19 type LastTriggerReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *LastTriggerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 200: 27 result := NewLastTriggerOK() 28 if err := result.readResponse(response, consumer, o.formats); err != nil { 29 return nil, err 30 } 31 return result, nil 32 case 400: 33 result := NewLastTriggerBadRequest() 34 if err := result.readResponse(response, consumer, o.formats); err != nil { 35 return nil, err 36 } 37 return nil, result 38 case 401: 39 result := NewLastTriggerUnauthorized() 40 if err := result.readResponse(response, consumer, o.formats); err != nil { 41 return nil, err 42 } 43 return nil, result 44 case 403: 45 result := NewLastTriggerForbidden() 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 := NewLastTriggerInternalServerError() 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 // NewLastTriggerOK creates a LastTriggerOK with default headers values 62 func NewLastTriggerOK() *LastTriggerOK { 63 return &LastTriggerOK{} 64 } 65 66 /* 67 LastTriggerOK describes a response with status code 200, with default header values. 68 69 Test webhook connection successfully. 70 */ 71 type LastTriggerOK struct { 72 Payload []*models.WebhookLastTrigger 73 } 74 75 // IsSuccess returns true when this last trigger o k response has a 2xx status code 76 func (o *LastTriggerOK) IsSuccess() bool { 77 return true 78 } 79 80 // IsRedirect returns true when this last trigger o k response has a 3xx status code 81 func (o *LastTriggerOK) IsRedirect() bool { 82 return false 83 } 84 85 // IsClientError returns true when this last trigger o k response has a 4xx status code 86 func (o *LastTriggerOK) IsClientError() bool { 87 return false 88 } 89 90 // IsServerError returns true when this last trigger o k response has a 5xx status code 91 func (o *LastTriggerOK) IsServerError() bool { 92 return false 93 } 94 95 // IsCode returns true when this last trigger o k response a status code equal to that given 96 func (o *LastTriggerOK) IsCode(code int) bool { 97 return code == 200 98 } 99 100 func (o *LastTriggerOK) Error() string { 101 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerOK %+v", 200, o.Payload) 102 } 103 104 func (o *LastTriggerOK) String() string { 105 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerOK %+v", 200, o.Payload) 106 } 107 108 func (o *LastTriggerOK) GetPayload() []*models.WebhookLastTrigger { 109 return o.Payload 110 } 111 112 func (o *LastTriggerOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 113 114 // response payload 115 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 116 return err 117 } 118 119 return nil 120 } 121 122 // NewLastTriggerBadRequest creates a LastTriggerBadRequest with default headers values 123 func NewLastTriggerBadRequest() *LastTriggerBadRequest { 124 return &LastTriggerBadRequest{} 125 } 126 127 /* 128 LastTriggerBadRequest describes a response with status code 400, with default header values. 129 130 Bad request 131 */ 132 type LastTriggerBadRequest struct { 133 134 /* The ID of the corresponding request for the response 135 */ 136 XRequestID string 137 138 Payload *models.Errors 139 } 140 141 // IsSuccess returns true when this last trigger bad request response has a 2xx status code 142 func (o *LastTriggerBadRequest) IsSuccess() bool { 143 return false 144 } 145 146 // IsRedirect returns true when this last trigger bad request response has a 3xx status code 147 func (o *LastTriggerBadRequest) IsRedirect() bool { 148 return false 149 } 150 151 // IsClientError returns true when this last trigger bad request response has a 4xx status code 152 func (o *LastTriggerBadRequest) IsClientError() bool { 153 return true 154 } 155 156 // IsServerError returns true when this last trigger bad request response has a 5xx status code 157 func (o *LastTriggerBadRequest) IsServerError() bool { 158 return false 159 } 160 161 // IsCode returns true when this last trigger bad request response a status code equal to that given 162 func (o *LastTriggerBadRequest) IsCode(code int) bool { 163 return code == 400 164 } 165 166 func (o *LastTriggerBadRequest) Error() string { 167 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerBadRequest %+v", 400, o.Payload) 168 } 169 170 func (o *LastTriggerBadRequest) String() string { 171 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerBadRequest %+v", 400, o.Payload) 172 } 173 174 func (o *LastTriggerBadRequest) GetPayload() *models.Errors { 175 return o.Payload 176 } 177 178 func (o *LastTriggerBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 179 180 // hydrates response header X-Request-Id 181 hdrXRequestID := response.GetHeader("X-Request-Id") 182 183 if hdrXRequestID != "" { 184 o.XRequestID = hdrXRequestID 185 } 186 187 o.Payload = new(models.Errors) 188 189 // response payload 190 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 191 return err 192 } 193 194 return nil 195 } 196 197 // NewLastTriggerUnauthorized creates a LastTriggerUnauthorized with default headers values 198 func NewLastTriggerUnauthorized() *LastTriggerUnauthorized { 199 return &LastTriggerUnauthorized{} 200 } 201 202 /* 203 LastTriggerUnauthorized describes a response with status code 401, with default header values. 204 205 Unauthorized 206 */ 207 type LastTriggerUnauthorized struct { 208 209 /* The ID of the corresponding request for the response 210 */ 211 XRequestID string 212 213 Payload *models.Errors 214 } 215 216 // IsSuccess returns true when this last trigger unauthorized response has a 2xx status code 217 func (o *LastTriggerUnauthorized) IsSuccess() bool { 218 return false 219 } 220 221 // IsRedirect returns true when this last trigger unauthorized response has a 3xx status code 222 func (o *LastTriggerUnauthorized) IsRedirect() bool { 223 return false 224 } 225 226 // IsClientError returns true when this last trigger unauthorized response has a 4xx status code 227 func (o *LastTriggerUnauthorized) IsClientError() bool { 228 return true 229 } 230 231 // IsServerError returns true when this last trigger unauthorized response has a 5xx status code 232 func (o *LastTriggerUnauthorized) IsServerError() bool { 233 return false 234 } 235 236 // IsCode returns true when this last trigger unauthorized response a status code equal to that given 237 func (o *LastTriggerUnauthorized) IsCode(code int) bool { 238 return code == 401 239 } 240 241 func (o *LastTriggerUnauthorized) Error() string { 242 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerUnauthorized %+v", 401, o.Payload) 243 } 244 245 func (o *LastTriggerUnauthorized) String() string { 246 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerUnauthorized %+v", 401, o.Payload) 247 } 248 249 func (o *LastTriggerUnauthorized) GetPayload() *models.Errors { 250 return o.Payload 251 } 252 253 func (o *LastTriggerUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 254 255 // hydrates response header X-Request-Id 256 hdrXRequestID := response.GetHeader("X-Request-Id") 257 258 if hdrXRequestID != "" { 259 o.XRequestID = hdrXRequestID 260 } 261 262 o.Payload = new(models.Errors) 263 264 // response payload 265 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 266 return err 267 } 268 269 return nil 270 } 271 272 // NewLastTriggerForbidden creates a LastTriggerForbidden with default headers values 273 func NewLastTriggerForbidden() *LastTriggerForbidden { 274 return &LastTriggerForbidden{} 275 } 276 277 /* 278 LastTriggerForbidden describes a response with status code 403, with default header values. 279 280 Forbidden 281 */ 282 type LastTriggerForbidden struct { 283 284 /* The ID of the corresponding request for the response 285 */ 286 XRequestID string 287 288 Payload *models.Errors 289 } 290 291 // IsSuccess returns true when this last trigger forbidden response has a 2xx status code 292 func (o *LastTriggerForbidden) IsSuccess() bool { 293 return false 294 } 295 296 // IsRedirect returns true when this last trigger forbidden response has a 3xx status code 297 func (o *LastTriggerForbidden) IsRedirect() bool { 298 return false 299 } 300 301 // IsClientError returns true when this last trigger forbidden response has a 4xx status code 302 func (o *LastTriggerForbidden) IsClientError() bool { 303 return true 304 } 305 306 // IsServerError returns true when this last trigger forbidden response has a 5xx status code 307 func (o *LastTriggerForbidden) IsServerError() bool { 308 return false 309 } 310 311 // IsCode returns true when this last trigger forbidden response a status code equal to that given 312 func (o *LastTriggerForbidden) IsCode(code int) bool { 313 return code == 403 314 } 315 316 func (o *LastTriggerForbidden) Error() string { 317 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerForbidden %+v", 403, o.Payload) 318 } 319 320 func (o *LastTriggerForbidden) String() string { 321 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerForbidden %+v", 403, o.Payload) 322 } 323 324 func (o *LastTriggerForbidden) GetPayload() *models.Errors { 325 return o.Payload 326 } 327 328 func (o *LastTriggerForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 329 330 // hydrates response header X-Request-Id 331 hdrXRequestID := response.GetHeader("X-Request-Id") 332 333 if hdrXRequestID != "" { 334 o.XRequestID = hdrXRequestID 335 } 336 337 o.Payload = new(models.Errors) 338 339 // response payload 340 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 341 return err 342 } 343 344 return nil 345 } 346 347 // NewLastTriggerInternalServerError creates a LastTriggerInternalServerError with default headers values 348 func NewLastTriggerInternalServerError() *LastTriggerInternalServerError { 349 return &LastTriggerInternalServerError{} 350 } 351 352 /* 353 LastTriggerInternalServerError describes a response with status code 500, with default header values. 354 355 Internal server error 356 */ 357 type LastTriggerInternalServerError struct { 358 359 /* The ID of the corresponding request for the response 360 */ 361 XRequestID string 362 363 Payload *models.Errors 364 } 365 366 // IsSuccess returns true when this last trigger internal server error response has a 2xx status code 367 func (o *LastTriggerInternalServerError) IsSuccess() bool { 368 return false 369 } 370 371 // IsRedirect returns true when this last trigger internal server error response has a 3xx status code 372 func (o *LastTriggerInternalServerError) IsRedirect() bool { 373 return false 374 } 375 376 // IsClientError returns true when this last trigger internal server error response has a 4xx status code 377 func (o *LastTriggerInternalServerError) IsClientError() bool { 378 return false 379 } 380 381 // IsServerError returns true when this last trigger internal server error response has a 5xx status code 382 func (o *LastTriggerInternalServerError) IsServerError() bool { 383 return true 384 } 385 386 // IsCode returns true when this last trigger internal server error response a status code equal to that given 387 func (o *LastTriggerInternalServerError) IsCode(code int) bool { 388 return code == 500 389 } 390 391 func (o *LastTriggerInternalServerError) Error() string { 392 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerInternalServerError %+v", 500, o.Payload) 393 } 394 395 func (o *LastTriggerInternalServerError) String() string { 396 return fmt.Sprintf("[GET /projects/{project_name_or_id}/webhook/lasttrigger][%d] lastTriggerInternalServerError %+v", 500, o.Payload) 397 } 398 399 func (o *LastTriggerInternalServerError) GetPayload() *models.Errors { 400 return o.Payload 401 } 402 403 func (o *LastTriggerInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 404 405 // hydrates response header X-Request-Id 406 hdrXRequestID := response.GetHeader("X-Request-Id") 407 408 if hdrXRequestID != "" { 409 o.XRequestID = hdrXRequestID 410 } 411 412 o.Payload = new(models.Errors) 413 414 // response payload 415 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 416 return err 417 } 418 419 return nil 420 }