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

// ListInfraEnvsReader is a Reader for the ListInfraEnvs structure.
type ListInfraEnvsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ListInfraEnvsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewListInfraEnvsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewListInfraEnvsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewListInfraEnvsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 405:
		result := NewListInfraEnvsMethodNotAllowed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewListInfraEnvsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 501:
		result := NewListInfraEnvsNotImplemented()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewListInfraEnvsServiceUnavailable()
		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())
	}
}

// NewListInfraEnvsOK creates a ListInfraEnvsOK with default headers values
func NewListInfraEnvsOK() *ListInfraEnvsOK {
	return &ListInfraEnvsOK{}
}

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

Success.
*/
type ListInfraEnvsOK struct {
	Payload models.InfraEnvList
}

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

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

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

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

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

func (o *ListInfraEnvsOK) Error() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsOK  %+v", 200, o.Payload)
}

func (o *ListInfraEnvsOK) String() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsOK  %+v", 200, o.Payload)
}

func (o *ListInfraEnvsOK) GetPayload() models.InfraEnvList {
	return o.Payload
}

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

// NewListInfraEnvsUnauthorized creates a ListInfraEnvsUnauthorized with default headers values
func NewListInfraEnvsUnauthorized() *ListInfraEnvsUnauthorized {
	return &ListInfraEnvsUnauthorized{}
}

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

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

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

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

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

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

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

func (o *ListInfraEnvsUnauthorized) Error() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsUnauthorized  %+v", 401, o.Payload)
}

func (o *ListInfraEnvsUnauthorized) String() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewListInfraEnvsForbidden creates a ListInfraEnvsForbidden with default headers values
func NewListInfraEnvsForbidden() *ListInfraEnvsForbidden {
	return &ListInfraEnvsForbidden{}
}

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

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

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

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

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

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

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

func (o *ListInfraEnvsForbidden) Error() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsForbidden  %+v", 403, o.Payload)
}

func (o *ListInfraEnvsForbidden) String() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsForbidden  %+v", 403, o.Payload)
}

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

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

// NewListInfraEnvsMethodNotAllowed creates a ListInfraEnvsMethodNotAllowed with default headers values
func NewListInfraEnvsMethodNotAllowed() *ListInfraEnvsMethodNotAllowed {
	return &ListInfraEnvsMethodNotAllowed{}
}

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

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

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

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

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

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

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

func (o *ListInfraEnvsMethodNotAllowed) Error() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsMethodNotAllowed  %+v", 405, o.Payload)
}

func (o *ListInfraEnvsMethodNotAllowed) String() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsMethodNotAllowed  %+v", 405, o.Payload)
}

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

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

// NewListInfraEnvsInternalServerError creates a ListInfraEnvsInternalServerError with default headers values
func NewListInfraEnvsInternalServerError() *ListInfraEnvsInternalServerError {
	return &ListInfraEnvsInternalServerError{}
}

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

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

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

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

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

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

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

func (o *ListInfraEnvsInternalServerError) Error() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsInternalServerError  %+v", 500, o.Payload)
}

func (o *ListInfraEnvsInternalServerError) String() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsInternalServerError  %+v", 500, o.Payload)
}

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

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

// NewListInfraEnvsNotImplemented creates a ListInfraEnvsNotImplemented with default headers values
func NewListInfraEnvsNotImplemented() *ListInfraEnvsNotImplemented {
	return &ListInfraEnvsNotImplemented{}
}

/*
ListInfraEnvsNotImplemented describes a response with status code 501, with default header values.

Not implemented.
*/
type ListInfraEnvsNotImplemented struct {
	Payload *models.Error
}

// IsSuccess returns true when this list infra envs not implemented response has a 2xx status code
func (o *ListInfraEnvsNotImplemented) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this list infra envs not implemented response has a 3xx status code
func (o *ListInfraEnvsNotImplemented) IsRedirect() bool {
	return false
}

// IsClientError returns true when this list infra envs not implemented response has a 4xx status code
func (o *ListInfraEnvsNotImplemented) IsClientError() bool {
	return false
}

// IsServerError returns true when this list infra envs not implemented response has a 5xx status code
func (o *ListInfraEnvsNotImplemented) IsServerError() bool {
	return true
}

// IsCode returns true when this list infra envs not implemented response a status code equal to that given
func (o *ListInfraEnvsNotImplemented) IsCode(code int) bool {
	return code == 501
}

func (o *ListInfraEnvsNotImplemented) Error() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsNotImplemented  %+v", 501, o.Payload)
}

func (o *ListInfraEnvsNotImplemented) String() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsNotImplemented  %+v", 501, o.Payload)
}

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

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

// NewListInfraEnvsServiceUnavailable creates a ListInfraEnvsServiceUnavailable with default headers values
func NewListInfraEnvsServiceUnavailable() *ListInfraEnvsServiceUnavailable {
	return &ListInfraEnvsServiceUnavailable{}
}

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

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

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

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

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

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

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

func (o *ListInfraEnvsServiceUnavailable) Error() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsServiceUnavailable  %+v", 503, o.Payload)
}

func (o *ListInfraEnvsServiceUnavailable) String() string {
	return fmt.Sprintf("[GET /v2/infra-envs][%d] listInfraEnvsServiceUnavailable  %+v", 503, o.Payload)
}

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

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