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

package dashboard_permissions

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

// UpdateDashboardPermissionsByUIDReader is a Reader for the UpdateDashboardPermissionsByUID structure.
type UpdateDashboardPermissionsByUIDReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UpdateDashboardPermissionsByUIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewUpdateDashboardPermissionsByUIDOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewUpdateDashboardPermissionsByUIDBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewUpdateDashboardPermissionsByUIDUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewUpdateDashboardPermissionsByUIDForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewUpdateDashboardPermissionsByUIDNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewUpdateDashboardPermissionsByUIDInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /dashboards/uid/{uid}/permissions] updateDashboardPermissionsByUID", response, response.Code())
	}
}

// NewUpdateDashboardPermissionsByUIDOK creates a UpdateDashboardPermissionsByUIDOK with default headers values
func NewUpdateDashboardPermissionsByUIDOK() *UpdateDashboardPermissionsByUIDOK {
	return &UpdateDashboardPermissionsByUIDOK{}
}

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

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

// IsSuccess returns true when this update dashboard permissions by Uid Ok response has a 2xx status code
func (o *UpdateDashboardPermissionsByUIDOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this update dashboard permissions by Uid Ok response has a 3xx status code
func (o *UpdateDashboardPermissionsByUIDOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this update dashboard permissions by Uid Ok response has a 4xx status code
func (o *UpdateDashboardPermissionsByUIDOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this update dashboard permissions by Uid Ok response has a 5xx status code
func (o *UpdateDashboardPermissionsByUIDOK) IsServerError() bool {
	return false
}

// IsCode returns true when this update dashboard permissions by Uid Ok response a status code equal to that given
func (o *UpdateDashboardPermissionsByUIDOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the update dashboard permissions by Uid Ok response
func (o *UpdateDashboardPermissionsByUIDOK) Code() int {
	return 200
}

func (o *UpdateDashboardPermissionsByUIDOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidOk %s", 200, payload)
}

func (o *UpdateDashboardPermissionsByUIDOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidOk %s", 200, payload)
}

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

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

// NewUpdateDashboardPermissionsByUIDBadRequest creates a UpdateDashboardPermissionsByUIDBadRequest with default headers values
func NewUpdateDashboardPermissionsByUIDBadRequest() *UpdateDashboardPermissionsByUIDBadRequest {
	return &UpdateDashboardPermissionsByUIDBadRequest{}
}

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

// IsSuccess returns true when this update dashboard permissions by Uid bad request response has a 2xx status code
func (o *UpdateDashboardPermissionsByUIDBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this update dashboard permissions by Uid bad request response has a 3xx status code
func (o *UpdateDashboardPermissionsByUIDBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this update dashboard permissions by Uid bad request response has a 4xx status code
func (o *UpdateDashboardPermissionsByUIDBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this update dashboard permissions by Uid bad request response has a 5xx status code
func (o *UpdateDashboardPermissionsByUIDBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this update dashboard permissions by Uid bad request response a status code equal to that given
func (o *UpdateDashboardPermissionsByUIDBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the update dashboard permissions by Uid bad request response
func (o *UpdateDashboardPermissionsByUIDBadRequest) Code() int {
	return 400
}

func (o *UpdateDashboardPermissionsByUIDBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidBadRequest %s", 400, payload)
}

func (o *UpdateDashboardPermissionsByUIDBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidBadRequest %s", 400, payload)
}

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

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

// NewUpdateDashboardPermissionsByUIDUnauthorized creates a UpdateDashboardPermissionsByUIDUnauthorized with default headers values
func NewUpdateDashboardPermissionsByUIDUnauthorized() *UpdateDashboardPermissionsByUIDUnauthorized {
	return &UpdateDashboardPermissionsByUIDUnauthorized{}
}

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

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

// IsSuccess returns true when this update dashboard permissions by Uid unauthorized response has a 2xx status code
func (o *UpdateDashboardPermissionsByUIDUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this update dashboard permissions by Uid unauthorized response has a 3xx status code
func (o *UpdateDashboardPermissionsByUIDUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this update dashboard permissions by Uid unauthorized response has a 4xx status code
func (o *UpdateDashboardPermissionsByUIDUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this update dashboard permissions by Uid unauthorized response has a 5xx status code
func (o *UpdateDashboardPermissionsByUIDUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this update dashboard permissions by Uid unauthorized response a status code equal to that given
func (o *UpdateDashboardPermissionsByUIDUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the update dashboard permissions by Uid unauthorized response
func (o *UpdateDashboardPermissionsByUIDUnauthorized) Code() int {
	return 401
}

func (o *UpdateDashboardPermissionsByUIDUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidUnauthorized %s", 401, payload)
}

func (o *UpdateDashboardPermissionsByUIDUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidUnauthorized %s", 401, payload)
}

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

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

// NewUpdateDashboardPermissionsByUIDForbidden creates a UpdateDashboardPermissionsByUIDForbidden with default headers values
func NewUpdateDashboardPermissionsByUIDForbidden() *UpdateDashboardPermissionsByUIDForbidden {
	return &UpdateDashboardPermissionsByUIDForbidden{}
}

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

// IsSuccess returns true when this update dashboard permissions by Uid forbidden response has a 2xx status code
func (o *UpdateDashboardPermissionsByUIDForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this update dashboard permissions by Uid forbidden response has a 3xx status code
func (o *UpdateDashboardPermissionsByUIDForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this update dashboard permissions by Uid forbidden response has a 4xx status code
func (o *UpdateDashboardPermissionsByUIDForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this update dashboard permissions by Uid forbidden response has a 5xx status code
func (o *UpdateDashboardPermissionsByUIDForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this update dashboard permissions by Uid forbidden response a status code equal to that given
func (o *UpdateDashboardPermissionsByUIDForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the update dashboard permissions by Uid forbidden response
func (o *UpdateDashboardPermissionsByUIDForbidden) Code() int {
	return 403
}

func (o *UpdateDashboardPermissionsByUIDForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidForbidden %s", 403, payload)
}

func (o *UpdateDashboardPermissionsByUIDForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidForbidden %s", 403, payload)
}

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

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

// NewUpdateDashboardPermissionsByUIDNotFound creates a UpdateDashboardPermissionsByUIDNotFound with default headers values
func NewUpdateDashboardPermissionsByUIDNotFound() *UpdateDashboardPermissionsByUIDNotFound {
	return &UpdateDashboardPermissionsByUIDNotFound{}
}

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

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

// IsSuccess returns true when this update dashboard permissions by Uid not found response has a 2xx status code
func (o *UpdateDashboardPermissionsByUIDNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this update dashboard permissions by Uid not found response has a 3xx status code
func (o *UpdateDashboardPermissionsByUIDNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this update dashboard permissions by Uid not found response has a 4xx status code
func (o *UpdateDashboardPermissionsByUIDNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this update dashboard permissions by Uid not found response has a 5xx status code
func (o *UpdateDashboardPermissionsByUIDNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this update dashboard permissions by Uid not found response a status code equal to that given
func (o *UpdateDashboardPermissionsByUIDNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the update dashboard permissions by Uid not found response
func (o *UpdateDashboardPermissionsByUIDNotFound) Code() int {
	return 404
}

func (o *UpdateDashboardPermissionsByUIDNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidNotFound %s", 404, payload)
}

func (o *UpdateDashboardPermissionsByUIDNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidNotFound %s", 404, payload)
}

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

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

// NewUpdateDashboardPermissionsByUIDInternalServerError creates a UpdateDashboardPermissionsByUIDInternalServerError with default headers values
func NewUpdateDashboardPermissionsByUIDInternalServerError() *UpdateDashboardPermissionsByUIDInternalServerError {
	return &UpdateDashboardPermissionsByUIDInternalServerError{}
}

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

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

// IsSuccess returns true when this update dashboard permissions by Uid internal server error response has a 2xx status code
func (o *UpdateDashboardPermissionsByUIDInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this update dashboard permissions by Uid internal server error response has a 3xx status code
func (o *UpdateDashboardPermissionsByUIDInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this update dashboard permissions by Uid internal server error response has a 4xx status code
func (o *UpdateDashboardPermissionsByUIDInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this update dashboard permissions by Uid internal server error response has a 5xx status code
func (o *UpdateDashboardPermissionsByUIDInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this update dashboard permissions by Uid internal server error response a status code equal to that given
func (o *UpdateDashboardPermissionsByUIDInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the update dashboard permissions by Uid internal server error response
func (o *UpdateDashboardPermissionsByUIDInternalServerError) Code() int {
	return 500
}

func (o *UpdateDashboardPermissionsByUIDInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidInternalServerError %s", 500, payload)
}

func (o *UpdateDashboardPermissionsByUIDInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /dashboards/uid/{uid}/permissions][%d] updateDashboardPermissionsByUidInternalServerError %s", 500, payload)
}

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

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