github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/project/head_project_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package project 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 // HeadProjectReader is a Reader for the HeadProject structure. 19 type HeadProjectReader struct { 20 formats strfmt.Registry 21 } 22 23 // ReadResponse reads a server response into the received o. 24 func (o *HeadProjectReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 25 switch response.Code() { 26 case 200: 27 result := NewHeadProjectOK() 28 if err := result.readResponse(response, consumer, o.formats); err != nil { 29 return nil, err 30 } 31 return result, nil 32 case 404: 33 result := NewHeadProjectNotFound() 34 if err := result.readResponse(response, consumer, o.formats); err != nil { 35 return nil, err 36 } 37 return nil, result 38 case 500: 39 result := NewHeadProjectInternalServerError() 40 if err := result.readResponse(response, consumer, o.formats); err != nil { 41 return nil, err 42 } 43 return nil, result 44 default: 45 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 46 } 47 } 48 49 // NewHeadProjectOK creates a HeadProjectOK with default headers values 50 func NewHeadProjectOK() *HeadProjectOK { 51 return &HeadProjectOK{} 52 } 53 54 /* 55 HeadProjectOK describes a response with status code 200, with default header values. 56 57 Success 58 */ 59 type HeadProjectOK struct { 60 61 /* The ID of the corresponding request for the response 62 */ 63 XRequestID string 64 } 65 66 // IsSuccess returns true when this head project o k response has a 2xx status code 67 func (o *HeadProjectOK) IsSuccess() bool { 68 return true 69 } 70 71 // IsRedirect returns true when this head project o k response has a 3xx status code 72 func (o *HeadProjectOK) IsRedirect() bool { 73 return false 74 } 75 76 // IsClientError returns true when this head project o k response has a 4xx status code 77 func (o *HeadProjectOK) IsClientError() bool { 78 return false 79 } 80 81 // IsServerError returns true when this head project o k response has a 5xx status code 82 func (o *HeadProjectOK) IsServerError() bool { 83 return false 84 } 85 86 // IsCode returns true when this head project o k response a status code equal to that given 87 func (o *HeadProjectOK) IsCode(code int) bool { 88 return code == 200 89 } 90 91 func (o *HeadProjectOK) Error() string { 92 return fmt.Sprintf("[HEAD /projects][%d] headProjectOK ", 200) 93 } 94 95 func (o *HeadProjectOK) String() string { 96 return fmt.Sprintf("[HEAD /projects][%d] headProjectOK ", 200) 97 } 98 99 func (o *HeadProjectOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 100 101 // hydrates response header X-Request-Id 102 hdrXRequestID := response.GetHeader("X-Request-Id") 103 104 if hdrXRequestID != "" { 105 o.XRequestID = hdrXRequestID 106 } 107 108 return nil 109 } 110 111 // NewHeadProjectNotFound creates a HeadProjectNotFound with default headers values 112 func NewHeadProjectNotFound() *HeadProjectNotFound { 113 return &HeadProjectNotFound{} 114 } 115 116 /* 117 HeadProjectNotFound describes a response with status code 404, with default header values. 118 119 Not found 120 */ 121 type HeadProjectNotFound struct { 122 123 /* The ID of the corresponding request for the response 124 */ 125 XRequestID string 126 127 Payload *models.Errors 128 } 129 130 // IsSuccess returns true when this head project not found response has a 2xx status code 131 func (o *HeadProjectNotFound) IsSuccess() bool { 132 return false 133 } 134 135 // IsRedirect returns true when this head project not found response has a 3xx status code 136 func (o *HeadProjectNotFound) IsRedirect() bool { 137 return false 138 } 139 140 // IsClientError returns true when this head project not found response has a 4xx status code 141 func (o *HeadProjectNotFound) IsClientError() bool { 142 return true 143 } 144 145 // IsServerError returns true when this head project not found response has a 5xx status code 146 func (o *HeadProjectNotFound) IsServerError() bool { 147 return false 148 } 149 150 // IsCode returns true when this head project not found response a status code equal to that given 151 func (o *HeadProjectNotFound) IsCode(code int) bool { 152 return code == 404 153 } 154 155 func (o *HeadProjectNotFound) Error() string { 156 return fmt.Sprintf("[HEAD /projects][%d] headProjectNotFound %+v", 404, o.Payload) 157 } 158 159 func (o *HeadProjectNotFound) String() string { 160 return fmt.Sprintf("[HEAD /projects][%d] headProjectNotFound %+v", 404, o.Payload) 161 } 162 163 func (o *HeadProjectNotFound) GetPayload() *models.Errors { 164 return o.Payload 165 } 166 167 func (o *HeadProjectNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 168 169 // hydrates response header X-Request-Id 170 hdrXRequestID := response.GetHeader("X-Request-Id") 171 172 if hdrXRequestID != "" { 173 o.XRequestID = hdrXRequestID 174 } 175 176 o.Payload = new(models.Errors) 177 178 // response payload 179 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 180 return err 181 } 182 183 return nil 184 } 185 186 // NewHeadProjectInternalServerError creates a HeadProjectInternalServerError with default headers values 187 func NewHeadProjectInternalServerError() *HeadProjectInternalServerError { 188 return &HeadProjectInternalServerError{} 189 } 190 191 /* 192 HeadProjectInternalServerError describes a response with status code 500, with default header values. 193 194 Internal server error 195 */ 196 type HeadProjectInternalServerError struct { 197 198 /* The ID of the corresponding request for the response 199 */ 200 XRequestID string 201 202 Payload *models.Errors 203 } 204 205 // IsSuccess returns true when this head project internal server error response has a 2xx status code 206 func (o *HeadProjectInternalServerError) IsSuccess() bool { 207 return false 208 } 209 210 // IsRedirect returns true when this head project internal server error response has a 3xx status code 211 func (o *HeadProjectInternalServerError) IsRedirect() bool { 212 return false 213 } 214 215 // IsClientError returns true when this head project internal server error response has a 4xx status code 216 func (o *HeadProjectInternalServerError) IsClientError() bool { 217 return false 218 } 219 220 // IsServerError returns true when this head project internal server error response has a 5xx status code 221 func (o *HeadProjectInternalServerError) IsServerError() bool { 222 return true 223 } 224 225 // IsCode returns true when this head project internal server error response a status code equal to that given 226 func (o *HeadProjectInternalServerError) IsCode(code int) bool { 227 return code == 500 228 } 229 230 func (o *HeadProjectInternalServerError) Error() string { 231 return fmt.Sprintf("[HEAD /projects][%d] headProjectInternalServerError %+v", 500, o.Payload) 232 } 233 234 func (o *HeadProjectInternalServerError) String() string { 235 return fmt.Sprintf("[HEAD /projects][%d] headProjectInternalServerError %+v", 500, o.Payload) 236 } 237 238 func (o *HeadProjectInternalServerError) GetPayload() *models.Errors { 239 return o.Payload 240 } 241 242 func (o *HeadProjectInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 243 244 // hydrates response header X-Request-Id 245 hdrXRequestID := response.GetHeader("X-Request-Id") 246 247 if hdrXRequestID != "" { 248 o.XRequestID = hdrXRequestID 249 } 250 251 o.Payload = new(models.Errors) 252 253 // response payload 254 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 255 return err 256 } 257 258 return nil 259 }