forked from TrueCloudLab/frostfs-rest-gw
[#15] Use extended error response
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
e28c6e5375
commit
9fba8d7f23
22 changed files with 528 additions and 174 deletions
|
@ -72,7 +72,7 @@ type AuthBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewAuthBadRequest creates AuthBadRequest with default headers values
|
||||
|
@ -82,13 +82,13 @@ func NewAuthBadRequest() *AuthBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the auth bad request response
|
||||
func (o *AuthBadRequest) WithPayload(payload models.Error) *AuthBadRequest {
|
||||
func (o *AuthBadRequest) WithPayload(payload *models.ErrorResponse) *AuthBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the auth bad request response
|
||||
func (o *AuthBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *AuthBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -96,8 +96,10 @@ func (o *AuthBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *AuthBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type DeleteContainerBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDeleteContainerBadRequest creates DeleteContainerBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewDeleteContainerBadRequest() *DeleteContainerBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the delete container bad request response
|
||||
func (o *DeleteContainerBadRequest) WithPayload(payload models.Error) *DeleteContainerBadRequest {
|
||||
func (o *DeleteContainerBadRequest) WithPayload(payload *models.ErrorResponse) *DeleteContainerBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the delete container bad request response
|
||||
func (o *DeleteContainerBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *DeleteContainerBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *DeleteContainerBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *DeleteContainerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type DeleteObjectBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDeleteObjectBadRequest creates DeleteObjectBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewDeleteObjectBadRequest() *DeleteObjectBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the delete object bad request response
|
||||
func (o *DeleteObjectBadRequest) WithPayload(payload models.Error) *DeleteObjectBadRequest {
|
||||
func (o *DeleteObjectBadRequest) WithPayload(payload *models.ErrorResponse) *DeleteObjectBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the delete object bad request response
|
||||
func (o *DeleteObjectBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *DeleteObjectBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *DeleteObjectBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *DeleteObjectBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type GetContainerEACLBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetContainerEACLBadRequest creates GetContainerEACLBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewGetContainerEACLBadRequest() *GetContainerEACLBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the get container e Acl bad request response
|
||||
func (o *GetContainerEACLBadRequest) WithPayload(payload models.Error) *GetContainerEACLBadRequest {
|
||||
func (o *GetContainerEACLBadRequest) WithPayload(payload *models.ErrorResponse) *GetContainerEACLBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get container e Acl bad request response
|
||||
func (o *GetContainerEACLBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *GetContainerEACLBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *GetContainerEACLBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *GetContainerEACLBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type GetContainerBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetContainerBadRequest creates GetContainerBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewGetContainerBadRequest() *GetContainerBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the get container bad request response
|
||||
func (o *GetContainerBadRequest) WithPayload(payload models.Error) *GetContainerBadRequest {
|
||||
func (o *GetContainerBadRequest) WithPayload(payload *models.ErrorResponse) *GetContainerBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get container bad request response
|
||||
func (o *GetContainerBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *GetContainerBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *GetContainerBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *GetContainerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type GetObjectInfoBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetObjectInfoBadRequest creates GetObjectInfoBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewGetObjectInfoBadRequest() *GetObjectInfoBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the get object info bad request response
|
||||
func (o *GetObjectInfoBadRequest) WithPayload(payload models.Error) *GetObjectInfoBadRequest {
|
||||
func (o *GetObjectInfoBadRequest) WithPayload(payload *models.ErrorResponse) *GetObjectInfoBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get object info bad request response
|
||||
func (o *GetObjectInfoBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *GetObjectInfoBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *GetObjectInfoBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *GetObjectInfoBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type ListContainersBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListContainersBadRequest creates ListContainersBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewListContainersBadRequest() *ListContainersBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the list containers bad request response
|
||||
func (o *ListContainersBadRequest) WithPayload(payload models.Error) *ListContainersBadRequest {
|
||||
func (o *ListContainersBadRequest) WithPayload(payload *models.ErrorResponse) *ListContainersBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list containers bad request response
|
||||
func (o *ListContainersBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *ListContainersBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *ListContainersBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *ListContainersBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type PutContainerEACLBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPutContainerEACLBadRequest creates PutContainerEACLBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewPutContainerEACLBadRequest() *PutContainerEACLBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the put container e Acl bad request response
|
||||
func (o *PutContainerEACLBadRequest) WithPayload(payload models.Error) *PutContainerEACLBadRequest {
|
||||
func (o *PutContainerEACLBadRequest) WithPayload(payload *models.ErrorResponse) *PutContainerEACLBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the put container e Acl bad request response
|
||||
func (o *PutContainerEACLBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *PutContainerEACLBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *PutContainerEACLBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *PutContainerEACLBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type PutContainerBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPutContainerBadRequest creates PutContainerBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewPutContainerBadRequest() *PutContainerBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the put container bad request response
|
||||
func (o *PutContainerBadRequest) WithPayload(payload models.Error) *PutContainerBadRequest {
|
||||
func (o *PutContainerBadRequest) WithPayload(payload *models.ErrorResponse) *PutContainerBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the put container bad request response
|
||||
func (o *PutContainerBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *PutContainerBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *PutContainerBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *PutContainerBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type PutObjectBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPutObjectBadRequest creates PutObjectBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewPutObjectBadRequest() *PutObjectBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the put object bad request response
|
||||
func (o *PutObjectBadRequest) WithPayload(payload models.Error) *PutObjectBadRequest {
|
||||
func (o *PutObjectBadRequest) WithPayload(payload *models.ErrorResponse) *PutObjectBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the put object bad request response
|
||||
func (o *PutObjectBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *PutObjectBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *PutObjectBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *PutObjectBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ type SearchObjectsBadRequest struct {
|
|||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.Error `json:"body,omitempty"`
|
||||
Payload *models.ErrorResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewSearchObjectsBadRequest creates SearchObjectsBadRequest with default headers values
|
||||
|
@ -79,13 +79,13 @@ func NewSearchObjectsBadRequest() *SearchObjectsBadRequest {
|
|||
}
|
||||
|
||||
// WithPayload adds the payload to the search objects bad request response
|
||||
func (o *SearchObjectsBadRequest) WithPayload(payload models.Error) *SearchObjectsBadRequest {
|
||||
func (o *SearchObjectsBadRequest) WithPayload(payload *models.ErrorResponse) *SearchObjectsBadRequest {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the search objects bad request response
|
||||
func (o *SearchObjectsBadRequest) SetPayload(payload models.Error) {
|
||||
func (o *SearchObjectsBadRequest) SetPayload(payload *models.ErrorResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,10 @@ func (o *SearchObjectsBadRequest) SetPayload(payload models.Error) {
|
|||
func (o *SearchObjectsBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(400)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue