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