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

package folder_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"
)

// UpdateFolderPermissionsReader is a Reader for the UpdateFolderPermissions structure.
type UpdateFolderPermissionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UpdateFolderPermissionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewUpdateFolderPermissionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewUpdateFolderPermissionsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewUpdateFolderPermissionsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewUpdateFolderPermissionsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewUpdateFolderPermissionsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /folders/{folder_uid}/permissions] updateFolderPermissions", response, response.Code())
	}
}

// NewUpdateFolderPermissionsOK creates a UpdateFolderPermissionsOK with default headers values
func NewUpdateFolderPermissionsOK() *UpdateFolderPermissionsOK {
	return &UpdateFolderPermissionsOK{}
}

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

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

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

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

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

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

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

// Code gets the status code for the update folder permissions Ok response
func (o *UpdateFolderPermissionsOK) Code() int {
	return 200
}

func (o *UpdateFolderPermissionsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsOk %s", 200, payload)
}

func (o *UpdateFolderPermissionsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsOk %s", 200, payload)
}

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

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

// NewUpdateFolderPermissionsUnauthorized creates a UpdateFolderPermissionsUnauthorized with default headers values
func NewUpdateFolderPermissionsUnauthorized() *UpdateFolderPermissionsUnauthorized {
	return &UpdateFolderPermissionsUnauthorized{}
}

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

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

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

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

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

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

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

// Code gets the status code for the update folder permissions unauthorized response
func (o *UpdateFolderPermissionsUnauthorized) Code() int {
	return 401
}

func (o *UpdateFolderPermissionsUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsUnauthorized %s", 401, payload)
}

func (o *UpdateFolderPermissionsUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsUnauthorized %s", 401, payload)
}

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

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

// NewUpdateFolderPermissionsForbidden creates a UpdateFolderPermissionsForbidden with default headers values
func NewUpdateFolderPermissionsForbidden() *UpdateFolderPermissionsForbidden {
	return &UpdateFolderPermissionsForbidden{}
}

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

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

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

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

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

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

// Code gets the status code for the update folder permissions forbidden response
func (o *UpdateFolderPermissionsForbidden) Code() int {
	return 403
}

func (o *UpdateFolderPermissionsForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsForbidden %s", 403, payload)
}

func (o *UpdateFolderPermissionsForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsForbidden %s", 403, payload)
}

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

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

// NewUpdateFolderPermissionsNotFound creates a UpdateFolderPermissionsNotFound with default headers values
func NewUpdateFolderPermissionsNotFound() *UpdateFolderPermissionsNotFound {
	return &UpdateFolderPermissionsNotFound{}
}

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

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

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

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

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

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

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

// Code gets the status code for the update folder permissions not found response
func (o *UpdateFolderPermissionsNotFound) Code() int {
	return 404
}

func (o *UpdateFolderPermissionsNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsNotFound %s", 404, payload)
}

func (o *UpdateFolderPermissionsNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsNotFound %s", 404, payload)
}

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

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

// NewUpdateFolderPermissionsInternalServerError creates a UpdateFolderPermissionsInternalServerError with default headers values
func NewUpdateFolderPermissionsInternalServerError() *UpdateFolderPermissionsInternalServerError {
	return &UpdateFolderPermissionsInternalServerError{}
}

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

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

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

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

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

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

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

// Code gets the status code for the update folder permissions internal server error response
func (o *UpdateFolderPermissionsInternalServerError) Code() int {
	return 500
}

func (o *UpdateFolderPermissionsInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsInternalServerError %s", 500, payload)
}

func (o *UpdateFolderPermissionsInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /folders/{folder_uid}/permissions][%d] updateFolderPermissionsInternalServerError %s", 500, payload)
}

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

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