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

package datasources

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

import (
	"encoding/json"
	"fmt"
	"io"

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

	"github.com/grafana/grafana-openapi-client-go/models"
)

// CallDatasourceResourceWithUIDReader is a Reader for the CallDatasourceResourceWithUID structure.
type CallDatasourceResourceWithUIDReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *CallDatasourceResourceWithUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewCallDatasourceResourceWithUIDOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewCallDatasourceResourceWithUIDBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewCallDatasourceResourceWithUIDUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewCallDatasourceResourceWithUIDForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewCallDatasourceResourceWithUIDNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewCallDatasourceResourceWithUIDInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}] callDatasourceResourceWithUID", response, response.Code())
	}
}

// NewCallDatasourceResourceWithUIDOK creates a CallDatasourceResourceWithUIDOK with default headers values
func NewCallDatasourceResourceWithUIDOK() *CallDatasourceResourceWithUIDOK {
	return &CallDatasourceResourceWithUIDOK{}
}

/*
CallDatasourceResourceWithUIDOK describes a response with status code 200, with default header values.

An OKResponse is returned if the request was successful.
*/
type CallDatasourceResourceWithUIDOK struct {
	Payload *models.SuccessResponseBody
}

// IsSuccess returns true when this call datasource resource with Uid Ok response has a 2xx status code
func (o *CallDatasourceResourceWithUIDOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this call datasource resource with Uid Ok response has a 3xx status code
func (o *CallDatasourceResourceWithUIDOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this call datasource resource with Uid Ok response has a 4xx status code
func (o *CallDatasourceResourceWithUIDOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this call datasource resource with Uid Ok response has a 5xx status code
func (o *CallDatasourceResourceWithUIDOK) IsServerError() bool {
	return false
}

// IsCode returns true when this call datasource resource with Uid Ok response a status code equal to that given
func (o *CallDatasourceResourceWithUIDOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the call datasource resource with Uid Ok response
func (o *CallDatasourceResourceWithUIDOK) Code() int {
	return 200
}

func (o *CallDatasourceResourceWithUIDOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidOk %s", 200, payload)
}

func (o *CallDatasourceResourceWithUIDOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidOk %s", 200, payload)
}

func (o *CallDatasourceResourceWithUIDOK) GetPayload() *models.SuccessResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.SuccessResponseBody)

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

	return nil
}

// NewCallDatasourceResourceWithUIDBadRequest creates a CallDatasourceResourceWithUIDBadRequest with default headers values
func NewCallDatasourceResourceWithUIDBadRequest() *CallDatasourceResourceWithUIDBadRequest {
	return &CallDatasourceResourceWithUIDBadRequest{}
}

/*
CallDatasourceResourceWithUIDBadRequest describes a response with status code 400, with default header values.

BadRequestError is returned when the request is invalid and it cannot be processed.
*/
type CallDatasourceResourceWithUIDBadRequest struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this call datasource resource with Uid bad request response has a 2xx status code
func (o *CallDatasourceResourceWithUIDBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this call datasource resource with Uid bad request response has a 3xx status code
func (o *CallDatasourceResourceWithUIDBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this call datasource resource with Uid bad request response has a 4xx status code
func (o *CallDatasourceResourceWithUIDBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this call datasource resource with Uid bad request response has a 5xx status code
func (o *CallDatasourceResourceWithUIDBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this call datasource resource with Uid bad request response a status code equal to that given
func (o *CallDatasourceResourceWithUIDBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the call datasource resource with Uid bad request response
func (o *CallDatasourceResourceWithUIDBadRequest) Code() int {
	return 400
}

func (o *CallDatasourceResourceWithUIDBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidBadRequest %s", 400, payload)
}

func (o *CallDatasourceResourceWithUIDBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidBadRequest %s", 400, payload)
}

func (o *CallDatasourceResourceWithUIDBadRequest) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}

// NewCallDatasourceResourceWithUIDUnauthorized creates a CallDatasourceResourceWithUIDUnauthorized with default headers values
func NewCallDatasourceResourceWithUIDUnauthorized() *CallDatasourceResourceWithUIDUnauthorized {
	return &CallDatasourceResourceWithUIDUnauthorized{}
}

/*
CallDatasourceResourceWithUIDUnauthorized describes a response with status code 401, with default header values.

UnauthorizedError is returned when the request is not authenticated.
*/
type CallDatasourceResourceWithUIDUnauthorized struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this call datasource resource with Uid unauthorized response has a 2xx status code
func (o *CallDatasourceResourceWithUIDUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this call datasource resource with Uid unauthorized response has a 3xx status code
func (o *CallDatasourceResourceWithUIDUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this call datasource resource with Uid unauthorized response has a 4xx status code
func (o *CallDatasourceResourceWithUIDUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this call datasource resource with Uid unauthorized response has a 5xx status code
func (o *CallDatasourceResourceWithUIDUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this call datasource resource with Uid unauthorized response a status code equal to that given
func (o *CallDatasourceResourceWithUIDUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the call datasource resource with Uid unauthorized response
func (o *CallDatasourceResourceWithUIDUnauthorized) Code() int {
	return 401
}

func (o *CallDatasourceResourceWithUIDUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidUnauthorized %s", 401, payload)
}

func (o *CallDatasourceResourceWithUIDUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidUnauthorized %s", 401, payload)
}

func (o *CallDatasourceResourceWithUIDUnauthorized) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}

// NewCallDatasourceResourceWithUIDForbidden creates a CallDatasourceResourceWithUIDForbidden with default headers values
func NewCallDatasourceResourceWithUIDForbidden() *CallDatasourceResourceWithUIDForbidden {
	return &CallDatasourceResourceWithUIDForbidden{}
}

/*
CallDatasourceResourceWithUIDForbidden describes a response with status code 403, with default header values.

ForbiddenError is returned if the user/token has insufficient permissions to access the requested resource.
*/
type CallDatasourceResourceWithUIDForbidden struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this call datasource resource with Uid forbidden response has a 2xx status code
func (o *CallDatasourceResourceWithUIDForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this call datasource resource with Uid forbidden response has a 3xx status code
func (o *CallDatasourceResourceWithUIDForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this call datasource resource with Uid forbidden response has a 4xx status code
func (o *CallDatasourceResourceWithUIDForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this call datasource resource with Uid forbidden response has a 5xx status code
func (o *CallDatasourceResourceWithUIDForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this call datasource resource with Uid forbidden response a status code equal to that given
func (o *CallDatasourceResourceWithUIDForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the call datasource resource with Uid forbidden response
func (o *CallDatasourceResourceWithUIDForbidden) Code() int {
	return 403
}

func (o *CallDatasourceResourceWithUIDForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidForbidden %s", 403, payload)
}

func (o *CallDatasourceResourceWithUIDForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidForbidden %s", 403, payload)
}

func (o *CallDatasourceResourceWithUIDForbidden) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}

// NewCallDatasourceResourceWithUIDNotFound creates a CallDatasourceResourceWithUIDNotFound with default headers values
func NewCallDatasourceResourceWithUIDNotFound() *CallDatasourceResourceWithUIDNotFound {
	return &CallDatasourceResourceWithUIDNotFound{}
}

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

NotFoundError is returned when the requested resource was not found.
*/
type CallDatasourceResourceWithUIDNotFound struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this call datasource resource with Uid not found response has a 2xx status code
func (o *CallDatasourceResourceWithUIDNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this call datasource resource with Uid not found response has a 3xx status code
func (o *CallDatasourceResourceWithUIDNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this call datasource resource with Uid not found response has a 4xx status code
func (o *CallDatasourceResourceWithUIDNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this call datasource resource with Uid not found response has a 5xx status code
func (o *CallDatasourceResourceWithUIDNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this call datasource resource with Uid not found response a status code equal to that given
func (o *CallDatasourceResourceWithUIDNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the call datasource resource with Uid not found response
func (o *CallDatasourceResourceWithUIDNotFound) Code() int {
	return 404
}

func (o *CallDatasourceResourceWithUIDNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidNotFound %s", 404, payload)
}

func (o *CallDatasourceResourceWithUIDNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidNotFound %s", 404, payload)
}

func (o *CallDatasourceResourceWithUIDNotFound) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}

// NewCallDatasourceResourceWithUIDInternalServerError creates a CallDatasourceResourceWithUIDInternalServerError with default headers values
func NewCallDatasourceResourceWithUIDInternalServerError() *CallDatasourceResourceWithUIDInternalServerError {
	return &CallDatasourceResourceWithUIDInternalServerError{}
}

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

InternalServerError is a general error indicating something went wrong internally.
*/
type CallDatasourceResourceWithUIDInternalServerError struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this call datasource resource with Uid internal server error response has a 2xx status code
func (o *CallDatasourceResourceWithUIDInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this call datasource resource with Uid internal server error response has a 3xx status code
func (o *CallDatasourceResourceWithUIDInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this call datasource resource with Uid internal server error response has a 4xx status code
func (o *CallDatasourceResourceWithUIDInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this call datasource resource with Uid internal server error response has a 5xx status code
func (o *CallDatasourceResourceWithUIDInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this call datasource resource with Uid internal server error response a status code equal to that given
func (o *CallDatasourceResourceWithUIDInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the call datasource resource with Uid internal server error response
func (o *CallDatasourceResourceWithUIDInternalServerError) Code() int {
	return 500
}

func (o *CallDatasourceResourceWithUIDInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidInternalServerError %s", 500, payload)
}

func (o *CallDatasourceResourceWithUIDInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /datasources/uid/{uid}/resources/{datasource_proxy_route}][%d] callDatasourceResourceWithUidInternalServerError %s", 500, payload)
}

func (o *CallDatasourceResourceWithUIDInternalServerError) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}
