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