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

// SetResourcePermissionsForBuiltInRoleReader is a Reader for the SetResourcePermissionsForBuiltInRole structure.
type SetResourcePermissionsForBuiltInRoleReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *SetResourcePermissionsForBuiltInRoleReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewSetResourcePermissionsForBuiltInRoleOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewSetResourcePermissionsForBuiltInRoleBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewSetResourcePermissionsForBuiltInRoleForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewSetResourcePermissionsForBuiltInRoleNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewSetResourcePermissionsForBuiltInRoleInternalServerError()
		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}/builtInRoles/{builtInRole}] setResourcePermissionsForBuiltInRole", response, response.Code())
	}
}

// NewSetResourcePermissionsForBuiltInRoleOK creates a SetResourcePermissionsForBuiltInRoleOK with default headers values
func NewSetResourcePermissionsForBuiltInRoleOK() *SetResourcePermissionsForBuiltInRoleOK {
	return &SetResourcePermissionsForBuiltInRoleOK{}
}

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

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

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

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

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

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

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

// Code gets the status code for the set resource permissions for built in role Ok response
func (o *SetResourcePermissionsForBuiltInRoleOK) Code() int {
	return 200
}

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

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

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

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

// NewSetResourcePermissionsForBuiltInRoleBadRequest creates a SetResourcePermissionsForBuiltInRoleBadRequest with default headers values
func NewSetResourcePermissionsForBuiltInRoleBadRequest() *SetResourcePermissionsForBuiltInRoleBadRequest {
	return &SetResourcePermissionsForBuiltInRoleBadRequest{}
}

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

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

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

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

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

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

// Code gets the status code for the set resource permissions for built in role bad request response
func (o *SetResourcePermissionsForBuiltInRoleBadRequest) Code() int {
	return 400
}

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

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

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

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

// NewSetResourcePermissionsForBuiltInRoleForbidden creates a SetResourcePermissionsForBuiltInRoleForbidden with default headers values
func NewSetResourcePermissionsForBuiltInRoleForbidden() *SetResourcePermissionsForBuiltInRoleForbidden {
	return &SetResourcePermissionsForBuiltInRoleForbidden{}
}

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

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

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

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

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

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

// Code gets the status code for the set resource permissions for built in role forbidden response
func (o *SetResourcePermissionsForBuiltInRoleForbidden) Code() int {
	return 403
}

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

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

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

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

// NewSetResourcePermissionsForBuiltInRoleNotFound creates a SetResourcePermissionsForBuiltInRoleNotFound with default headers values
func NewSetResourcePermissionsForBuiltInRoleNotFound() *SetResourcePermissionsForBuiltInRoleNotFound {
	return &SetResourcePermissionsForBuiltInRoleNotFound{}
}

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

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

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

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

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

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

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

// Code gets the status code for the set resource permissions for built in role not found response
func (o *SetResourcePermissionsForBuiltInRoleNotFound) Code() int {
	return 404
}

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

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

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

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

// NewSetResourcePermissionsForBuiltInRoleInternalServerError creates a SetResourcePermissionsForBuiltInRoleInternalServerError with default headers values
func NewSetResourcePermissionsForBuiltInRoleInternalServerError() *SetResourcePermissionsForBuiltInRoleInternalServerError {
	return &SetResourcePermissionsForBuiltInRoleInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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