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

// V2InstallHostReader is a Reader for the V2InstallHost structure.
type V2InstallHostReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *V2InstallHostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 202:
		result := NewV2InstallHostAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewV2InstallHostUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewV2InstallHostForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewV2InstallHostNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewV2InstallHostConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewV2InstallHostInternalServerError()
		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())
	}
}

// NewV2InstallHostAccepted creates a V2InstallHostAccepted with default headers values
func NewV2InstallHostAccepted() *V2InstallHostAccepted {
	return &V2InstallHostAccepted{}
}

/*
V2InstallHostAccepted describes a response with status code 202, with default header values.

Success.
*/
type V2InstallHostAccepted struct {
	Payload *models.Host
}

// IsSuccess returns true when this v2 install host accepted response has a 2xx status code
func (o *V2InstallHostAccepted) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this v2 install host accepted response has a 3xx status code
func (o *V2InstallHostAccepted) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 install host accepted response has a 4xx status code
func (o *V2InstallHostAccepted) IsClientError() bool {
	return false
}

// IsServerError returns true when this v2 install host accepted response has a 5xx status code
func (o *V2InstallHostAccepted) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 install host accepted response a status code equal to that given
func (o *V2InstallHostAccepted) IsCode(code int) bool {
	return code == 202
}

func (o *V2InstallHostAccepted) Error() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostAccepted  %+v", 202, o.Payload)
}

func (o *V2InstallHostAccepted) String() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostAccepted  %+v", 202, o.Payload)
}

func (o *V2InstallHostAccepted) GetPayload() *models.Host {
	return o.Payload
}

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

	o.Payload = new(models.Host)

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

	return nil
}

// NewV2InstallHostUnauthorized creates a V2InstallHostUnauthorized with default headers values
func NewV2InstallHostUnauthorized() *V2InstallHostUnauthorized {
	return &V2InstallHostUnauthorized{}
}

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

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

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

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

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

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

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

func (o *V2InstallHostUnauthorized) Error() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostUnauthorized  %+v", 401, o.Payload)
}

func (o *V2InstallHostUnauthorized) String() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewV2InstallHostForbidden creates a V2InstallHostForbidden with default headers values
func NewV2InstallHostForbidden() *V2InstallHostForbidden {
	return &V2InstallHostForbidden{}
}

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

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

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

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

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

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

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

func (o *V2InstallHostForbidden) Error() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostForbidden  %+v", 403, o.Payload)
}

func (o *V2InstallHostForbidden) String() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostForbidden  %+v", 403, o.Payload)
}

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

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

// NewV2InstallHostNotFound creates a V2InstallHostNotFound with default headers values
func NewV2InstallHostNotFound() *V2InstallHostNotFound {
	return &V2InstallHostNotFound{}
}

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

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

// IsSuccess returns true when this v2 install host not found response has a 2xx status code
func (o *V2InstallHostNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 install host not found response has a 3xx status code
func (o *V2InstallHostNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 install host not found response has a 4xx status code
func (o *V2InstallHostNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this v2 install host not found response has a 5xx status code
func (o *V2InstallHostNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 install host not found response a status code equal to that given
func (o *V2InstallHostNotFound) IsCode(code int) bool {
	return code == 404
}

func (o *V2InstallHostNotFound) Error() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostNotFound  %+v", 404, o.Payload)
}

func (o *V2InstallHostNotFound) String() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostNotFound  %+v", 404, o.Payload)
}

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

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

// NewV2InstallHostConflict creates a V2InstallHostConflict with default headers values
func NewV2InstallHostConflict() *V2InstallHostConflict {
	return &V2InstallHostConflict{}
}

/*
V2InstallHostConflict describes a response with status code 409, with default header values.

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

// IsSuccess returns true when this v2 install host conflict response has a 2xx status code
func (o *V2InstallHostConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 install host conflict response has a 3xx status code
func (o *V2InstallHostConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 install host conflict response has a 4xx status code
func (o *V2InstallHostConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this v2 install host conflict response has a 5xx status code
func (o *V2InstallHostConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 install host conflict response a status code equal to that given
func (o *V2InstallHostConflict) IsCode(code int) bool {
	return code == 409
}

func (o *V2InstallHostConflict) Error() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostConflict  %+v", 409, o.Payload)
}

func (o *V2InstallHostConflict) String() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostConflict  %+v", 409, o.Payload)
}

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

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

// NewV2InstallHostInternalServerError creates a V2InstallHostInternalServerError with default headers values
func NewV2InstallHostInternalServerError() *V2InstallHostInternalServerError {
	return &V2InstallHostInternalServerError{}
}

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

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

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

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

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

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

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

func (o *V2InstallHostInternalServerError) Error() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostInternalServerError  %+v", 500, o.Payload)
}

func (o *V2InstallHostInternalServerError) String() string {
	return fmt.Sprintf("[POST /v2/infra-envs/{infra_env_id}/hosts/{host_id}/actions/install][%d] v2InstallHostInternalServerError  %+v", 500, o.Payload)
}

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

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