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

package versions

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

// V2ListSupportedOpenshiftVersionsReader is a Reader for the V2ListSupportedOpenshiftVersions structure.
type V2ListSupportedOpenshiftVersionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *V2ListSupportedOpenshiftVersionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewV2ListSupportedOpenshiftVersionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewV2ListSupportedOpenshiftVersionsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewV2ListSupportedOpenshiftVersionsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewV2ListSupportedOpenshiftVersionsServiceUnavailable()
		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())
	}
}

// NewV2ListSupportedOpenshiftVersionsOK creates a V2ListSupportedOpenshiftVersionsOK with default headers values
func NewV2ListSupportedOpenshiftVersionsOK() *V2ListSupportedOpenshiftVersionsOK {
	return &V2ListSupportedOpenshiftVersionsOK{}
}

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

Success.
*/
type V2ListSupportedOpenshiftVersionsOK struct {
	Payload models.OpenshiftVersions
}

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

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

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

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

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

func (o *V2ListSupportedOpenshiftVersionsOK) Error() string {
	return fmt.Sprintf("[GET /v2/openshift-versions][%d] v2ListSupportedOpenshiftVersionsOK  %+v", 200, o.Payload)
}

func (o *V2ListSupportedOpenshiftVersionsOK) String() string {
	return fmt.Sprintf("[GET /v2/openshift-versions][%d] v2ListSupportedOpenshiftVersionsOK  %+v", 200, o.Payload)
}

func (o *V2ListSupportedOpenshiftVersionsOK) GetPayload() models.OpenshiftVersions {
	return o.Payload
}

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

// NewV2ListSupportedOpenshiftVersionsBadRequest creates a V2ListSupportedOpenshiftVersionsBadRequest with default headers values
func NewV2ListSupportedOpenshiftVersionsBadRequest() *V2ListSupportedOpenshiftVersionsBadRequest {
	return &V2ListSupportedOpenshiftVersionsBadRequest{}
}

/*
V2ListSupportedOpenshiftVersionsBadRequest describes a response with status code 400, with default header values.

Bad Request
*/
type V2ListSupportedOpenshiftVersionsBadRequest struct {
	Payload *models.Error
}

// IsSuccess returns true when this v2 list supported openshift versions bad request response has a 2xx status code
func (o *V2ListSupportedOpenshiftVersionsBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 list supported openshift versions bad request response has a 3xx status code
func (o *V2ListSupportedOpenshiftVersionsBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 list supported openshift versions bad request response has a 4xx status code
func (o *V2ListSupportedOpenshiftVersionsBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this v2 list supported openshift versions bad request response has a 5xx status code
func (o *V2ListSupportedOpenshiftVersionsBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 list supported openshift versions bad request response a status code equal to that given
func (o *V2ListSupportedOpenshiftVersionsBadRequest) IsCode(code int) bool {
	return code == 400
}

func (o *V2ListSupportedOpenshiftVersionsBadRequest) Error() string {
	return fmt.Sprintf("[GET /v2/openshift-versions][%d] v2ListSupportedOpenshiftVersionsBadRequest  %+v", 400, o.Payload)
}

func (o *V2ListSupportedOpenshiftVersionsBadRequest) String() string {
	return fmt.Sprintf("[GET /v2/openshift-versions][%d] v2ListSupportedOpenshiftVersionsBadRequest  %+v", 400, o.Payload)
}

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

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

// NewV2ListSupportedOpenshiftVersionsInternalServerError creates a V2ListSupportedOpenshiftVersionsInternalServerError with default headers values
func NewV2ListSupportedOpenshiftVersionsInternalServerError() *V2ListSupportedOpenshiftVersionsInternalServerError {
	return &V2ListSupportedOpenshiftVersionsInternalServerError{}
}

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

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

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

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

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

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

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

func (o *V2ListSupportedOpenshiftVersionsInternalServerError) Error() string {
	return fmt.Sprintf("[GET /v2/openshift-versions][%d] v2ListSupportedOpenshiftVersionsInternalServerError  %+v", 500, o.Payload)
}

func (o *V2ListSupportedOpenshiftVersionsInternalServerError) String() string {
	return fmt.Sprintf("[GET /v2/openshift-versions][%d] v2ListSupportedOpenshiftVersionsInternalServerError  %+v", 500, o.Payload)
}

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

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

// NewV2ListSupportedOpenshiftVersionsServiceUnavailable creates a V2ListSupportedOpenshiftVersionsServiceUnavailable with default headers values
func NewV2ListSupportedOpenshiftVersionsServiceUnavailable() *V2ListSupportedOpenshiftVersionsServiceUnavailable {
	return &V2ListSupportedOpenshiftVersionsServiceUnavailable{}
}

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

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

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

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

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

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

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

func (o *V2ListSupportedOpenshiftVersionsServiceUnavailable) Error() string {
	return fmt.Sprintf("[GET /v2/openshift-versions][%d] v2ListSupportedOpenshiftVersionsServiceUnavailable  %+v", 503, o.Payload)
}

func (o *V2ListSupportedOpenshiftVersionsServiceUnavailable) String() string {
	return fmt.Sprintf("[GET /v2/openshift-versions][%d] v2ListSupportedOpenshiftVersionsServiceUnavailable  %+v", 503, o.Payload)
}

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

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