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

// SetResourcePermissionsForTeamReader is a Reader for the SetResourcePermissionsForTeam structure.
type SetResourcePermissionsForTeamReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *SetResourcePermissionsForTeamReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewSetResourcePermissionsForTeamOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewSetResourcePermissionsForTeamBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewSetResourcePermissionsForTeamForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewSetResourcePermissionsForTeamNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewSetResourcePermissionsForTeamInternalServerError()
		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}/teams/{teamID}] setResourcePermissionsForTeam", response, response.Code())
	}
}

// NewSetResourcePermissionsForTeamOK creates a SetResourcePermissionsForTeamOK with default headers values
func NewSetResourcePermissionsForTeamOK() *SetResourcePermissionsForTeamOK {
	return &SetResourcePermissionsForTeamOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewSetResourcePermissionsForTeamBadRequest creates a SetResourcePermissionsForTeamBadRequest with default headers values
func NewSetResourcePermissionsForTeamBadRequest() *SetResourcePermissionsForTeamBadRequest {
	return &SetResourcePermissionsForTeamBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewSetResourcePermissionsForTeamForbidden creates a SetResourcePermissionsForTeamForbidden with default headers values
func NewSetResourcePermissionsForTeamForbidden() *SetResourcePermissionsForTeamForbidden {
	return &SetResourcePermissionsForTeamForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewSetResourcePermissionsForTeamNotFound creates a SetResourcePermissionsForTeamNotFound with default headers values
func NewSetResourcePermissionsForTeamNotFound() *SetResourcePermissionsForTeamNotFound {
	return &SetResourcePermissionsForTeamNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewSetResourcePermissionsForTeamInternalServerError creates a SetResourcePermissionsForTeamInternalServerError with default headers values
func NewSetResourcePermissionsForTeamInternalServerError() *SetResourcePermissionsForTeamInternalServerError {
	return &SetResourcePermissionsForTeamInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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