// Code generated by go-swagger; DO NOT EDIT.

package operations

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/pingcap/test-infra/services/sdkserver/diag/models"
)

// CancelDataUploadReader is a Reader for the CancelDataUpload structure.
type CancelDataUploadReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *CancelDataUploadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 202:
		result := NewCancelDataUploadAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 204:
		result := NewCancelDataUploadNoContent()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 404:
		result := NewCancelDataUploadNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 410:
		result := NewCancelDataUploadGone()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewCancelDataUploadInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewCancelDataUploadAccepted creates a CancelDataUploadAccepted with default headers values
func NewCancelDataUploadAccepted() *CancelDataUploadAccepted {
	return &CancelDataUploadAccepted{}
}

/* CancelDataUploadAccepted describes a response with status code 202, with default header values.

upload has finished, no need to cancal
*/
type CancelDataUploadAccepted struct {
	Payload *models.UploadTask
}

func (o *CancelDataUploadAccepted) Error() string {
	return fmt.Sprintf("[DELETE /data/{id}/upload][%d] cancelDataUploadAccepted  %+v", 202, o.Payload)
}
func (o *CancelDataUploadAccepted) GetPayload() *models.UploadTask {
	return o.Payload
}

func (o *CancelDataUploadAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.UploadTask)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCancelDataUploadNoContent creates a CancelDataUploadNoContent with default headers values
func NewCancelDataUploadNoContent() *CancelDataUploadNoContent {
	return &CancelDataUploadNoContent{}
}

/* CancelDataUploadNoContent describes a response with status code 204, with default header values.

upload cancelled
*/
type CancelDataUploadNoContent struct {
}

func (o *CancelDataUploadNoContent) Error() string {
	return fmt.Sprintf("[DELETE /data/{id}/upload][%d] cancelDataUploadNoContent ", 204)
}

func (o *CancelDataUploadNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	return nil
}

// NewCancelDataUploadNotFound creates a CancelDataUploadNotFound with default headers values
func NewCancelDataUploadNotFound() *CancelDataUploadNotFound {
	return &CancelDataUploadNotFound{}
}

/* CancelDataUploadNotFound describes a response with status code 404, with default header values.

data set not found
*/
type CancelDataUploadNotFound struct {
	Payload *models.ResponseMsg
}

func (o *CancelDataUploadNotFound) Error() string {
	return fmt.Sprintf("[DELETE /data/{id}/upload][%d] cancelDataUploadNotFound  %+v", 404, o.Payload)
}
func (o *CancelDataUploadNotFound) GetPayload() *models.ResponseMsg {
	return o.Payload
}

func (o *CancelDataUploadNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ResponseMsg)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCancelDataUploadGone creates a CancelDataUploadGone with default headers values
func NewCancelDataUploadGone() *CancelDataUploadGone {
	return &CancelDataUploadGone{}
}

/* CancelDataUploadGone describes a response with status code 410, with default header values.

the upload has already been cancelled
*/
type CancelDataUploadGone struct {
	Payload *models.UploadTask
}

func (o *CancelDataUploadGone) Error() string {
	return fmt.Sprintf("[DELETE /data/{id}/upload][%d] cancelDataUploadGone  %+v", 410, o.Payload)
}
func (o *CancelDataUploadGone) GetPayload() *models.UploadTask {
	return o.Payload
}

func (o *CancelDataUploadGone) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.UploadTask)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCancelDataUploadInternalServerError creates a CancelDataUploadInternalServerError with default headers values
func NewCancelDataUploadInternalServerError() *CancelDataUploadInternalServerError {
	return &CancelDataUploadInternalServerError{}
}

/* CancelDataUploadInternalServerError describes a response with status code 500, with default header values.

server side error
*/
type CancelDataUploadInternalServerError struct {
	Payload *models.ResponseMsg
}

func (o *CancelDataUploadInternalServerError) Error() string {
	return fmt.Sprintf("[DELETE /data/{id}/upload][%d] cancelDataUploadInternalServerError  %+v", 500, o.Payload)
}
func (o *CancelDataUploadInternalServerError) GetPayload() *models.ResponseMsg {
	return o.Payload
}

func (o *CancelDataUploadInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.ResponseMsg)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}
