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

package recording_rules

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/grafana/grafana-openapi-client-go/models"
)

// TestCreateRecordingRuleReader is a Reader for the TestCreateRecordingRule structure.
type TestCreateRecordingRuleReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *TestCreateRecordingRuleReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewTestCreateRecordingRuleOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewTestCreateRecordingRuleUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewTestCreateRecordingRuleForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewTestCreateRecordingRuleNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewTestCreateRecordingRuleUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewTestCreateRecordingRuleInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /recording-rules/test] testCreateRecordingRule", response, response.Code())
	}
}

// NewTestCreateRecordingRuleOK creates a TestCreateRecordingRuleOK with default headers values
func NewTestCreateRecordingRuleOK() *TestCreateRecordingRuleOK {
	return &TestCreateRecordingRuleOK{}
}

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

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

// IsSuccess returns true when this test create recording rule Ok response has a 2xx status code
func (o *TestCreateRecordingRuleOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this test create recording rule Ok response has a 3xx status code
func (o *TestCreateRecordingRuleOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this test create recording rule Ok response has a 4xx status code
func (o *TestCreateRecordingRuleOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this test create recording rule Ok response has a 5xx status code
func (o *TestCreateRecordingRuleOK) IsServerError() bool {
	return false
}

// IsCode returns true when this test create recording rule Ok response a status code equal to that given
func (o *TestCreateRecordingRuleOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the test create recording rule Ok response
func (o *TestCreateRecordingRuleOK) Code() int {
	return 200
}

func (o *TestCreateRecordingRuleOK) Error() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleOk  %+v", 200, o.Payload)
}

func (o *TestCreateRecordingRuleOK) String() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleOk  %+v", 200, o.Payload)
}

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

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

// NewTestCreateRecordingRuleUnauthorized creates a TestCreateRecordingRuleUnauthorized with default headers values
func NewTestCreateRecordingRuleUnauthorized() *TestCreateRecordingRuleUnauthorized {
	return &TestCreateRecordingRuleUnauthorized{}
}

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

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

// IsSuccess returns true when this test create recording rule unauthorized response has a 2xx status code
func (o *TestCreateRecordingRuleUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this test create recording rule unauthorized response has a 3xx status code
func (o *TestCreateRecordingRuleUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this test create recording rule unauthorized response has a 4xx status code
func (o *TestCreateRecordingRuleUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this test create recording rule unauthorized response has a 5xx status code
func (o *TestCreateRecordingRuleUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this test create recording rule unauthorized response a status code equal to that given
func (o *TestCreateRecordingRuleUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the test create recording rule unauthorized response
func (o *TestCreateRecordingRuleUnauthorized) Code() int {
	return 401
}

func (o *TestCreateRecordingRuleUnauthorized) Error() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleUnauthorized  %+v", 401, o.Payload)
}

func (o *TestCreateRecordingRuleUnauthorized) String() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewTestCreateRecordingRuleForbidden creates a TestCreateRecordingRuleForbidden with default headers values
func NewTestCreateRecordingRuleForbidden() *TestCreateRecordingRuleForbidden {
	return &TestCreateRecordingRuleForbidden{}
}

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

// IsSuccess returns true when this test create recording rule forbidden response has a 2xx status code
func (o *TestCreateRecordingRuleForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this test create recording rule forbidden response has a 3xx status code
func (o *TestCreateRecordingRuleForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this test create recording rule forbidden response has a 4xx status code
func (o *TestCreateRecordingRuleForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this test create recording rule forbidden response has a 5xx status code
func (o *TestCreateRecordingRuleForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this test create recording rule forbidden response a status code equal to that given
func (o *TestCreateRecordingRuleForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the test create recording rule forbidden response
func (o *TestCreateRecordingRuleForbidden) Code() int {
	return 403
}

func (o *TestCreateRecordingRuleForbidden) Error() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleForbidden  %+v", 403, o.Payload)
}

func (o *TestCreateRecordingRuleForbidden) String() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleForbidden  %+v", 403, o.Payload)
}

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

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

// NewTestCreateRecordingRuleNotFound creates a TestCreateRecordingRuleNotFound with default headers values
func NewTestCreateRecordingRuleNotFound() *TestCreateRecordingRuleNotFound {
	return &TestCreateRecordingRuleNotFound{}
}

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

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

// IsSuccess returns true when this test create recording rule not found response has a 2xx status code
func (o *TestCreateRecordingRuleNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this test create recording rule not found response has a 3xx status code
func (o *TestCreateRecordingRuleNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this test create recording rule not found response has a 4xx status code
func (o *TestCreateRecordingRuleNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this test create recording rule not found response has a 5xx status code
func (o *TestCreateRecordingRuleNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this test create recording rule not found response a status code equal to that given
func (o *TestCreateRecordingRuleNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the test create recording rule not found response
func (o *TestCreateRecordingRuleNotFound) Code() int {
	return 404
}

func (o *TestCreateRecordingRuleNotFound) Error() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleNotFound  %+v", 404, o.Payload)
}

func (o *TestCreateRecordingRuleNotFound) String() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleNotFound  %+v", 404, o.Payload)
}

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

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

// NewTestCreateRecordingRuleUnprocessableEntity creates a TestCreateRecordingRuleUnprocessableEntity with default headers values
func NewTestCreateRecordingRuleUnprocessableEntity() *TestCreateRecordingRuleUnprocessableEntity {
	return &TestCreateRecordingRuleUnprocessableEntity{}
}

/*
TestCreateRecordingRuleUnprocessableEntity describes a response with status code 422, with default header values.

UnprocessableEntityError
*/
type TestCreateRecordingRuleUnprocessableEntity struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this test create recording rule unprocessable entity response has a 2xx status code
func (o *TestCreateRecordingRuleUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this test create recording rule unprocessable entity response has a 3xx status code
func (o *TestCreateRecordingRuleUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this test create recording rule unprocessable entity response has a 4xx status code
func (o *TestCreateRecordingRuleUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this test create recording rule unprocessable entity response has a 5xx status code
func (o *TestCreateRecordingRuleUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this test create recording rule unprocessable entity response a status code equal to that given
func (o *TestCreateRecordingRuleUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the test create recording rule unprocessable entity response
func (o *TestCreateRecordingRuleUnprocessableEntity) Code() int {
	return 422
}

func (o *TestCreateRecordingRuleUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *TestCreateRecordingRuleUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleUnprocessableEntity  %+v", 422, o.Payload)
}

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

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

// NewTestCreateRecordingRuleInternalServerError creates a TestCreateRecordingRuleInternalServerError with default headers values
func NewTestCreateRecordingRuleInternalServerError() *TestCreateRecordingRuleInternalServerError {
	return &TestCreateRecordingRuleInternalServerError{}
}

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

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

// IsSuccess returns true when this test create recording rule internal server error response has a 2xx status code
func (o *TestCreateRecordingRuleInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this test create recording rule internal server error response has a 3xx status code
func (o *TestCreateRecordingRuleInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this test create recording rule internal server error response has a 4xx status code
func (o *TestCreateRecordingRuleInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this test create recording rule internal server error response has a 5xx status code
func (o *TestCreateRecordingRuleInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this test create recording rule internal server error response a status code equal to that given
func (o *TestCreateRecordingRuleInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the test create recording rule internal server error response
func (o *TestCreateRecordingRuleInternalServerError) Code() int {
	return 500
}

func (o *TestCreateRecordingRuleInternalServerError) Error() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleInternalServerError  %+v", 500, o.Payload)
}

func (o *TestCreateRecordingRuleInternalServerError) String() string {
	return fmt.Sprintf("[POST /recording-rules/test][%d] testCreateRecordingRuleInternalServerError  %+v", 500, o.Payload)
}

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

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