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

package installer

// 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/openshift/assisted-service/models"
)

// V2ListClustersReader is a Reader for the V2ListClusters structure.
type V2ListClustersReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *V2ListClustersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewV2ListClustersOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewV2ListClustersUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewV2ListClustersForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 405:
		result := NewV2ListClustersMethodNotAllowed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewV2ListClustersInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewV2ListClustersServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewV2ListClustersOK creates a V2ListClustersOK with default headers values
func NewV2ListClustersOK() *V2ListClustersOK {
	return &V2ListClustersOK{}
}

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

Success.
*/
type V2ListClustersOK struct {
	Payload models.ClusterList
}

// IsSuccess returns true when this v2 list clusters o k response has a 2xx status code
func (o *V2ListClustersOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this v2 list clusters o k response has a 3xx status code
func (o *V2ListClustersOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 list clusters o k response has a 4xx status code
func (o *V2ListClustersOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this v2 list clusters o k response has a 5xx status code
func (o *V2ListClustersOK) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 list clusters o k response a status code equal to that given
func (o *V2ListClustersOK) IsCode(code int) bool {
	return code == 200
}

func (o *V2ListClustersOK) Error() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersOK  %+v", 200, o.Payload)
}

func (o *V2ListClustersOK) String() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersOK  %+v", 200, o.Payload)
}

func (o *V2ListClustersOK) GetPayload() models.ClusterList {
	return o.Payload
}

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

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

	return nil
}

// NewV2ListClustersUnauthorized creates a V2ListClustersUnauthorized with default headers values
func NewV2ListClustersUnauthorized() *V2ListClustersUnauthorized {
	return &V2ListClustersUnauthorized{}
}

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

Unauthorized.
*/
type V2ListClustersUnauthorized struct {
	Payload *models.InfraError
}

// IsSuccess returns true when this v2 list clusters unauthorized response has a 2xx status code
func (o *V2ListClustersUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 list clusters unauthorized response has a 3xx status code
func (o *V2ListClustersUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 list clusters unauthorized response has a 4xx status code
func (o *V2ListClustersUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this v2 list clusters unauthorized response has a 5xx status code
func (o *V2ListClustersUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 list clusters unauthorized response a status code equal to that given
func (o *V2ListClustersUnauthorized) IsCode(code int) bool {
	return code == 401
}

func (o *V2ListClustersUnauthorized) Error() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersUnauthorized  %+v", 401, o.Payload)
}

func (o *V2ListClustersUnauthorized) String() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersUnauthorized  %+v", 401, o.Payload)
}

func (o *V2ListClustersUnauthorized) GetPayload() *models.InfraError {
	return o.Payload
}

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

	o.Payload = new(models.InfraError)

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

	return nil
}

// NewV2ListClustersForbidden creates a V2ListClustersForbidden with default headers values
func NewV2ListClustersForbidden() *V2ListClustersForbidden {
	return &V2ListClustersForbidden{}
}

/*
V2ListClustersForbidden describes a response with status code 403, with default header values.

Forbidden.
*/
type V2ListClustersForbidden struct {
	Payload *models.InfraError
}

// IsSuccess returns true when this v2 list clusters forbidden response has a 2xx status code
func (o *V2ListClustersForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 list clusters forbidden response has a 3xx status code
func (o *V2ListClustersForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 list clusters forbidden response has a 4xx status code
func (o *V2ListClustersForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this v2 list clusters forbidden response has a 5xx status code
func (o *V2ListClustersForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 list clusters forbidden response a status code equal to that given
func (o *V2ListClustersForbidden) IsCode(code int) bool {
	return code == 403
}

func (o *V2ListClustersForbidden) Error() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersForbidden  %+v", 403, o.Payload)
}

func (o *V2ListClustersForbidden) String() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersForbidden  %+v", 403, o.Payload)
}

func (o *V2ListClustersForbidden) GetPayload() *models.InfraError {
	return o.Payload
}

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

	o.Payload = new(models.InfraError)

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

	return nil
}

// NewV2ListClustersMethodNotAllowed creates a V2ListClustersMethodNotAllowed with default headers values
func NewV2ListClustersMethodNotAllowed() *V2ListClustersMethodNotAllowed {
	return &V2ListClustersMethodNotAllowed{}
}

/*
V2ListClustersMethodNotAllowed describes a response with status code 405, with default header values.

Method Not Allowed.
*/
type V2ListClustersMethodNotAllowed struct {
	Payload *models.Error
}

// IsSuccess returns true when this v2 list clusters method not allowed response has a 2xx status code
func (o *V2ListClustersMethodNotAllowed) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 list clusters method not allowed response has a 3xx status code
func (o *V2ListClustersMethodNotAllowed) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 list clusters method not allowed response has a 4xx status code
func (o *V2ListClustersMethodNotAllowed) IsClientError() bool {
	return true
}

// IsServerError returns true when this v2 list clusters method not allowed response has a 5xx status code
func (o *V2ListClustersMethodNotAllowed) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 list clusters method not allowed response a status code equal to that given
func (o *V2ListClustersMethodNotAllowed) IsCode(code int) bool {
	return code == 405
}

func (o *V2ListClustersMethodNotAllowed) Error() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersMethodNotAllowed  %+v", 405, o.Payload)
}

func (o *V2ListClustersMethodNotAllowed) String() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersMethodNotAllowed  %+v", 405, o.Payload)
}

func (o *V2ListClustersMethodNotAllowed) GetPayload() *models.Error {
	return o.Payload
}

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

	o.Payload = new(models.Error)

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

	return nil
}

// NewV2ListClustersInternalServerError creates a V2ListClustersInternalServerError with default headers values
func NewV2ListClustersInternalServerError() *V2ListClustersInternalServerError {
	return &V2ListClustersInternalServerError{}
}

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

Error.
*/
type V2ListClustersInternalServerError struct {
	Payload *models.Error
}

// IsSuccess returns true when this v2 list clusters internal server error response has a 2xx status code
func (o *V2ListClustersInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 list clusters internal server error response has a 3xx status code
func (o *V2ListClustersInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 list clusters internal server error response has a 4xx status code
func (o *V2ListClustersInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this v2 list clusters internal server error response has a 5xx status code
func (o *V2ListClustersInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this v2 list clusters internal server error response a status code equal to that given
func (o *V2ListClustersInternalServerError) IsCode(code int) bool {
	return code == 500
}

func (o *V2ListClustersInternalServerError) Error() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersInternalServerError  %+v", 500, o.Payload)
}

func (o *V2ListClustersInternalServerError) String() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersInternalServerError  %+v", 500, o.Payload)
}

func (o *V2ListClustersInternalServerError) GetPayload() *models.Error {
	return o.Payload
}

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

	o.Payload = new(models.Error)

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

	return nil
}

// NewV2ListClustersServiceUnavailable creates a V2ListClustersServiceUnavailable with default headers values
func NewV2ListClustersServiceUnavailable() *V2ListClustersServiceUnavailable {
	return &V2ListClustersServiceUnavailable{}
}

/*
V2ListClustersServiceUnavailable describes a response with status code 503, with default header values.

Unavailable.
*/
type V2ListClustersServiceUnavailable struct {
	Payload *models.Error
}

// IsSuccess returns true when this v2 list clusters service unavailable response has a 2xx status code
func (o *V2ListClustersServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 list clusters service unavailable response has a 3xx status code
func (o *V2ListClustersServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 list clusters service unavailable response has a 4xx status code
func (o *V2ListClustersServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this v2 list clusters service unavailable response has a 5xx status code
func (o *V2ListClustersServiceUnavailable) IsServerError() bool {
	return true
}

// IsCode returns true when this v2 list clusters service unavailable response a status code equal to that given
func (o *V2ListClustersServiceUnavailable) IsCode(code int) bool {
	return code == 503
}

func (o *V2ListClustersServiceUnavailable) Error() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersServiceUnavailable  %+v", 503, o.Payload)
}

func (o *V2ListClustersServiceUnavailable) String() string {
	return fmt.Sprintf("[GET /v2/clusters][%d] v2ListClustersServiceUnavailable  %+v", 503, o.Payload)
}

func (o *V2ListClustersServiceUnavailable) GetPayload() *models.Error {
	return o.Payload
}

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

	o.Payload = new(models.Error)

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

	return nil
}
