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

package admin_provisioning

// 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"
)

// AdminProvisioningReloadDatasourcesReader is a Reader for the AdminProvisioningReloadDatasources structure.
type AdminProvisioningReloadDatasourcesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *AdminProvisioningReloadDatasourcesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewAdminProvisioningReloadDatasourcesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewAdminProvisioningReloadDatasourcesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewAdminProvisioningReloadDatasourcesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewAdminProvisioningReloadDatasourcesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /admin/provisioning/datasources/reload] adminProvisioningReloadDatasources", response, response.Code())
	}
}

// NewAdminProvisioningReloadDatasourcesOK creates a AdminProvisioningReloadDatasourcesOK with default headers values
func NewAdminProvisioningReloadDatasourcesOK() *AdminProvisioningReloadDatasourcesOK {
	return &AdminProvisioningReloadDatasourcesOK{}
}

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

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

// IsSuccess returns true when this admin provisioning reload datasources Ok response has a 2xx status code
func (o *AdminProvisioningReloadDatasourcesOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this admin provisioning reload datasources Ok response has a 3xx status code
func (o *AdminProvisioningReloadDatasourcesOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this admin provisioning reload datasources Ok response has a 4xx status code
func (o *AdminProvisioningReloadDatasourcesOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this admin provisioning reload datasources Ok response has a 5xx status code
func (o *AdminProvisioningReloadDatasourcesOK) IsServerError() bool {
	return false
}

// IsCode returns true when this admin provisioning reload datasources Ok response a status code equal to that given
func (o *AdminProvisioningReloadDatasourcesOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the admin provisioning reload datasources Ok response
func (o *AdminProvisioningReloadDatasourcesOK) Code() int {
	return 200
}

func (o *AdminProvisioningReloadDatasourcesOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/provisioning/datasources/reload][%d] adminProvisioningReloadDatasourcesOk %s", 200, payload)
}

func (o *AdminProvisioningReloadDatasourcesOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/provisioning/datasources/reload][%d] adminProvisioningReloadDatasourcesOk %s", 200, payload)
}

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

func (o *AdminProvisioningReloadDatasourcesOK) 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
}

// NewAdminProvisioningReloadDatasourcesUnauthorized creates a AdminProvisioningReloadDatasourcesUnauthorized with default headers values
func NewAdminProvisioningReloadDatasourcesUnauthorized() *AdminProvisioningReloadDatasourcesUnauthorized {
	return &AdminProvisioningReloadDatasourcesUnauthorized{}
}

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

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

// IsSuccess returns true when this admin provisioning reload datasources unauthorized response has a 2xx status code
func (o *AdminProvisioningReloadDatasourcesUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this admin provisioning reload datasources unauthorized response has a 3xx status code
func (o *AdminProvisioningReloadDatasourcesUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this admin provisioning reload datasources unauthorized response has a 4xx status code
func (o *AdminProvisioningReloadDatasourcesUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this admin provisioning reload datasources unauthorized response has a 5xx status code
func (o *AdminProvisioningReloadDatasourcesUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this admin provisioning reload datasources unauthorized response a status code equal to that given
func (o *AdminProvisioningReloadDatasourcesUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the admin provisioning reload datasources unauthorized response
func (o *AdminProvisioningReloadDatasourcesUnauthorized) Code() int {
	return 401
}

func (o *AdminProvisioningReloadDatasourcesUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/provisioning/datasources/reload][%d] adminProvisioningReloadDatasourcesUnauthorized %s", 401, payload)
}

func (o *AdminProvisioningReloadDatasourcesUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/provisioning/datasources/reload][%d] adminProvisioningReloadDatasourcesUnauthorized %s", 401, payload)
}

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

func (o *AdminProvisioningReloadDatasourcesUnauthorized) 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
}

// NewAdminProvisioningReloadDatasourcesForbidden creates a AdminProvisioningReloadDatasourcesForbidden with default headers values
func NewAdminProvisioningReloadDatasourcesForbidden() *AdminProvisioningReloadDatasourcesForbidden {
	return &AdminProvisioningReloadDatasourcesForbidden{}
}

/*
AdminProvisioningReloadDatasourcesForbidden 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 AdminProvisioningReloadDatasourcesForbidden struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this admin provisioning reload datasources forbidden response has a 2xx status code
func (o *AdminProvisioningReloadDatasourcesForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this admin provisioning reload datasources forbidden response has a 3xx status code
func (o *AdminProvisioningReloadDatasourcesForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this admin provisioning reload datasources forbidden response has a 4xx status code
func (o *AdminProvisioningReloadDatasourcesForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this admin provisioning reload datasources forbidden response has a 5xx status code
func (o *AdminProvisioningReloadDatasourcesForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this admin provisioning reload datasources forbidden response a status code equal to that given
func (o *AdminProvisioningReloadDatasourcesForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the admin provisioning reload datasources forbidden response
func (o *AdminProvisioningReloadDatasourcesForbidden) Code() int {
	return 403
}

func (o *AdminProvisioningReloadDatasourcesForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/provisioning/datasources/reload][%d] adminProvisioningReloadDatasourcesForbidden %s", 403, payload)
}

func (o *AdminProvisioningReloadDatasourcesForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/provisioning/datasources/reload][%d] adminProvisioningReloadDatasourcesForbidden %s", 403, payload)
}

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

func (o *AdminProvisioningReloadDatasourcesForbidden) 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
}

// NewAdminProvisioningReloadDatasourcesInternalServerError creates a AdminProvisioningReloadDatasourcesInternalServerError with default headers values
func NewAdminProvisioningReloadDatasourcesInternalServerError() *AdminProvisioningReloadDatasourcesInternalServerError {
	return &AdminProvisioningReloadDatasourcesInternalServerError{}
}

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

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

// IsSuccess returns true when this admin provisioning reload datasources internal server error response has a 2xx status code
func (o *AdminProvisioningReloadDatasourcesInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this admin provisioning reload datasources internal server error response has a 3xx status code
func (o *AdminProvisioningReloadDatasourcesInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this admin provisioning reload datasources internal server error response has a 4xx status code
func (o *AdminProvisioningReloadDatasourcesInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this admin provisioning reload datasources internal server error response has a 5xx status code
func (o *AdminProvisioningReloadDatasourcesInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this admin provisioning reload datasources internal server error response a status code equal to that given
func (o *AdminProvisioningReloadDatasourcesInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the admin provisioning reload datasources internal server error response
func (o *AdminProvisioningReloadDatasourcesInternalServerError) Code() int {
	return 500
}

func (o *AdminProvisioningReloadDatasourcesInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/provisioning/datasources/reload][%d] adminProvisioningReloadDatasourcesInternalServerError %s", 500, payload)
}

func (o *AdminProvisioningReloadDatasourcesInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /admin/provisioning/datasources/reload][%d] adminProvisioningReloadDatasourcesInternalServerError %s", 500, payload)
}

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

func (o *AdminProvisioningReloadDatasourcesInternalServerError) 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
}
