// 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 (
	"encoding/json"
	"fmt"
	"io"

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

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

// CreateRecordingRuleWriteTargetReader is a Reader for the CreateRecordingRuleWriteTarget structure.
type CreateRecordingRuleWriteTargetReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *CreateRecordingRuleWriteTargetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewCreateRecordingRuleWriteTargetOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewCreateRecordingRuleWriteTargetUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewCreateRecordingRuleWriteTargetForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewCreateRecordingRuleWriteTargetNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewCreateRecordingRuleWriteTargetUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewCreateRecordingRuleWriteTargetInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /recording-rules/writer] createRecordingRuleWriteTarget", response, response.Code())
	}
}

// NewCreateRecordingRuleWriteTargetOK creates a CreateRecordingRuleWriteTargetOK with default headers values
func NewCreateRecordingRuleWriteTargetOK() *CreateRecordingRuleWriteTargetOK {
	return &CreateRecordingRuleWriteTargetOK{}
}

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

(empty)
*/
type CreateRecordingRuleWriteTargetOK struct {
	Payload *models.PrometheusRemoteWriteTargetJSON
}

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

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

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

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

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

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

func (o *CreateRecordingRuleWriteTargetOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetOk %s", 200, payload)
}

func (o *CreateRecordingRuleWriteTargetOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetOk %s", 200, payload)
}

func (o *CreateRecordingRuleWriteTargetOK) GetPayload() *models.PrometheusRemoteWriteTargetJSON {
	return o.Payload
}

func (o *CreateRecordingRuleWriteTargetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.PrometheusRemoteWriteTargetJSON)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCreateRecordingRuleWriteTargetUnauthorized creates a CreateRecordingRuleWriteTargetUnauthorized with default headers values
func NewCreateRecordingRuleWriteTargetUnauthorized() *CreateRecordingRuleWriteTargetUnauthorized {
	return &CreateRecordingRuleWriteTargetUnauthorized{}
}

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

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

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

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

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

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

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

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

func (o *CreateRecordingRuleWriteTargetUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetUnauthorized %s", 401, payload)
}

func (o *CreateRecordingRuleWriteTargetUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetUnauthorized %s", 401, payload)
}

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

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

// NewCreateRecordingRuleWriteTargetForbidden creates a CreateRecordingRuleWriteTargetForbidden with default headers values
func NewCreateRecordingRuleWriteTargetForbidden() *CreateRecordingRuleWriteTargetForbidden {
	return &CreateRecordingRuleWriteTargetForbidden{}
}

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

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

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

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

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

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

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

func (o *CreateRecordingRuleWriteTargetForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetForbidden %s", 403, payload)
}

func (o *CreateRecordingRuleWriteTargetForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetForbidden %s", 403, payload)
}

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

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

// NewCreateRecordingRuleWriteTargetNotFound creates a CreateRecordingRuleWriteTargetNotFound with default headers values
func NewCreateRecordingRuleWriteTargetNotFound() *CreateRecordingRuleWriteTargetNotFound {
	return &CreateRecordingRuleWriteTargetNotFound{}
}

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

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

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

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

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

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

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

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

func (o *CreateRecordingRuleWriteTargetNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetNotFound %s", 404, payload)
}

func (o *CreateRecordingRuleWriteTargetNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetNotFound %s", 404, payload)
}

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

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

// NewCreateRecordingRuleWriteTargetUnprocessableEntity creates a CreateRecordingRuleWriteTargetUnprocessableEntity with default headers values
func NewCreateRecordingRuleWriteTargetUnprocessableEntity() *CreateRecordingRuleWriteTargetUnprocessableEntity {
	return &CreateRecordingRuleWriteTargetUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

func (o *CreateRecordingRuleWriteTargetUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetUnprocessableEntity %s", 422, payload)
}

func (o *CreateRecordingRuleWriteTargetUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetUnprocessableEntity %s", 422, payload)
}

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

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

// NewCreateRecordingRuleWriteTargetInternalServerError creates a CreateRecordingRuleWriteTargetInternalServerError with default headers values
func NewCreateRecordingRuleWriteTargetInternalServerError() *CreateRecordingRuleWriteTargetInternalServerError {
	return &CreateRecordingRuleWriteTargetInternalServerError{}
}

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

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

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

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

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

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

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

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

func (o *CreateRecordingRuleWriteTargetInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetInternalServerError %s", 500, payload)
}

func (o *CreateRecordingRuleWriteTargetInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /recording-rules/writer][%d] createRecordingRuleWriteTargetInternalServerError %s", 500, payload)
}

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

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