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

package access_control

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

// SetResourcePermissionsForUserReader is a Reader for the SetResourcePermissionsForUser structure.
type SetResourcePermissionsForUserReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *SetResourcePermissionsForUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewSetResourcePermissionsForUserOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewSetResourcePermissionsForUserBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewSetResourcePermissionsForUserForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewSetResourcePermissionsForUserNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewSetResourcePermissionsForUserInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /access-control/{resource}/{resourceID}/users/{userID}] setResourcePermissionsForUser", response, response.Code())
	}
}

// NewSetResourcePermissionsForUserOK creates a SetResourcePermissionsForUserOK with default headers values
func NewSetResourcePermissionsForUserOK() *SetResourcePermissionsForUserOK {
	return &SetResourcePermissionsForUserOK{}
}

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

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

// IsSuccess returns true when this set resource permissions for user Ok response has a 2xx status code
func (o *SetResourcePermissionsForUserOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this set resource permissions for user Ok response has a 3xx status code
func (o *SetResourcePermissionsForUserOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this set resource permissions for user Ok response has a 4xx status code
func (o *SetResourcePermissionsForUserOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this set resource permissions for user Ok response has a 5xx status code
func (o *SetResourcePermissionsForUserOK) IsServerError() bool {
	return false
}

// IsCode returns true when this set resource permissions for user Ok response a status code equal to that given
func (o *SetResourcePermissionsForUserOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the set resource permissions for user Ok response
func (o *SetResourcePermissionsForUserOK) Code() int {
	return 200
}

func (o *SetResourcePermissionsForUserOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserOk %s", 200, payload)
}

func (o *SetResourcePermissionsForUserOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserOk %s", 200, payload)
}

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

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

// NewSetResourcePermissionsForUserBadRequest creates a SetResourcePermissionsForUserBadRequest with default headers values
func NewSetResourcePermissionsForUserBadRequest() *SetResourcePermissionsForUserBadRequest {
	return &SetResourcePermissionsForUserBadRequest{}
}

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

// IsSuccess returns true when this set resource permissions for user bad request response has a 2xx status code
func (o *SetResourcePermissionsForUserBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this set resource permissions for user bad request response has a 3xx status code
func (o *SetResourcePermissionsForUserBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this set resource permissions for user bad request response has a 4xx status code
func (o *SetResourcePermissionsForUserBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this set resource permissions for user bad request response has a 5xx status code
func (o *SetResourcePermissionsForUserBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this set resource permissions for user bad request response a status code equal to that given
func (o *SetResourcePermissionsForUserBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the set resource permissions for user bad request response
func (o *SetResourcePermissionsForUserBadRequest) Code() int {
	return 400
}

func (o *SetResourcePermissionsForUserBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserBadRequest %s", 400, payload)
}

func (o *SetResourcePermissionsForUserBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserBadRequest %s", 400, payload)
}

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

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

// NewSetResourcePermissionsForUserForbidden creates a SetResourcePermissionsForUserForbidden with default headers values
func NewSetResourcePermissionsForUserForbidden() *SetResourcePermissionsForUserForbidden {
	return &SetResourcePermissionsForUserForbidden{}
}

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

// IsSuccess returns true when this set resource permissions for user forbidden response has a 2xx status code
func (o *SetResourcePermissionsForUserForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this set resource permissions for user forbidden response has a 3xx status code
func (o *SetResourcePermissionsForUserForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this set resource permissions for user forbidden response has a 4xx status code
func (o *SetResourcePermissionsForUserForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this set resource permissions for user forbidden response has a 5xx status code
func (o *SetResourcePermissionsForUserForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this set resource permissions for user forbidden response a status code equal to that given
func (o *SetResourcePermissionsForUserForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the set resource permissions for user forbidden response
func (o *SetResourcePermissionsForUserForbidden) Code() int {
	return 403
}

func (o *SetResourcePermissionsForUserForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserForbidden %s", 403, payload)
}

func (o *SetResourcePermissionsForUserForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserForbidden %s", 403, payload)
}

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

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

// NewSetResourcePermissionsForUserNotFound creates a SetResourcePermissionsForUserNotFound with default headers values
func NewSetResourcePermissionsForUserNotFound() *SetResourcePermissionsForUserNotFound {
	return &SetResourcePermissionsForUserNotFound{}
}

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

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

// IsSuccess returns true when this set resource permissions for user not found response has a 2xx status code
func (o *SetResourcePermissionsForUserNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this set resource permissions for user not found response has a 3xx status code
func (o *SetResourcePermissionsForUserNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this set resource permissions for user not found response has a 4xx status code
func (o *SetResourcePermissionsForUserNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this set resource permissions for user not found response has a 5xx status code
func (o *SetResourcePermissionsForUserNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this set resource permissions for user not found response a status code equal to that given
func (o *SetResourcePermissionsForUserNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the set resource permissions for user not found response
func (o *SetResourcePermissionsForUserNotFound) Code() int {
	return 404
}

func (o *SetResourcePermissionsForUserNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserNotFound %s", 404, payload)
}

func (o *SetResourcePermissionsForUserNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserNotFound %s", 404, payload)
}

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

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

// NewSetResourcePermissionsForUserInternalServerError creates a SetResourcePermissionsForUserInternalServerError with default headers values
func NewSetResourcePermissionsForUserInternalServerError() *SetResourcePermissionsForUserInternalServerError {
	return &SetResourcePermissionsForUserInternalServerError{}
}

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

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

// IsSuccess returns true when this set resource permissions for user internal server error response has a 2xx status code
func (o *SetResourcePermissionsForUserInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this set resource permissions for user internal server error response has a 3xx status code
func (o *SetResourcePermissionsForUserInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this set resource permissions for user internal server error response has a 4xx status code
func (o *SetResourcePermissionsForUserInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this set resource permissions for user internal server error response has a 5xx status code
func (o *SetResourcePermissionsForUserInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this set resource permissions for user internal server error response a status code equal to that given
func (o *SetResourcePermissionsForUserInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the set resource permissions for user internal server error response
func (o *SetResourcePermissionsForUserInternalServerError) Code() int {
	return 500
}

func (o *SetResourcePermissionsForUserInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserInternalServerError %s", 500, payload)
}

func (o *SetResourcePermissionsForUserInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /access-control/{resource}/{resourceID}/users/{userID}][%d] setResourcePermissionsForUserInternalServerError %s", 500, payload)
}

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

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