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

// GetRecordingRuleWriteTargetReader is a Reader for the GetRecordingRuleWriteTarget structure.
type GetRecordingRuleWriteTargetReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetRecordingRuleWriteTargetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetRecordingRuleWriteTargetOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetRecordingRuleWriteTargetUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetRecordingRuleWriteTargetForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetRecordingRuleWriteTargetNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetRecordingRuleWriteTargetInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /recording-rules/writer] getRecordingRuleWriteTarget", response, response.Code())
	}
}

// NewGetRecordingRuleWriteTargetOK creates a GetRecordingRuleWriteTargetOK with default headers values
func NewGetRecordingRuleWriteTargetOK() *GetRecordingRuleWriteTargetOK {
	return &GetRecordingRuleWriteTargetOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetRecordingRuleWriteTargetUnauthorized creates a GetRecordingRuleWriteTargetUnauthorized with default headers values
func NewGetRecordingRuleWriteTargetUnauthorized() *GetRecordingRuleWriteTargetUnauthorized {
	return &GetRecordingRuleWriteTargetUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetRecordingRuleWriteTargetForbidden creates a GetRecordingRuleWriteTargetForbidden with default headers values
func NewGetRecordingRuleWriteTargetForbidden() *GetRecordingRuleWriteTargetForbidden {
	return &GetRecordingRuleWriteTargetForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetRecordingRuleWriteTargetNotFound creates a GetRecordingRuleWriteTargetNotFound with default headers values
func NewGetRecordingRuleWriteTargetNotFound() *GetRecordingRuleWriteTargetNotFound {
	return &GetRecordingRuleWriteTargetNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetRecordingRuleWriteTargetInternalServerError creates a GetRecordingRuleWriteTargetInternalServerError with default headers values
func NewGetRecordingRuleWriteTargetInternalServerError() *GetRecordingRuleWriteTargetInternalServerError {
	return &GetRecordingRuleWriteTargetInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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