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

// V2InstallClusterReader is a Reader for the V2InstallCluster structure.
type V2InstallClusterReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *V2InstallClusterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 202:
		result := NewV2InstallClusterAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewV2InstallClusterBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewV2InstallClusterUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewV2InstallClusterForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewV2InstallClusterNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 405:
		result := NewV2InstallClusterMethodNotAllowed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewV2InstallClusterConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewV2InstallClusterInternalServerError()
		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())
	}
}

// NewV2InstallClusterAccepted creates a V2InstallClusterAccepted with default headers values
func NewV2InstallClusterAccepted() *V2InstallClusterAccepted {
	return &V2InstallClusterAccepted{}
}

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

Success.
*/
type V2InstallClusterAccepted struct {
	Payload *models.Cluster
}

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

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

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

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

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

func (o *V2InstallClusterAccepted) Error() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterAccepted  %+v", 202, o.Payload)
}

func (o *V2InstallClusterAccepted) String() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterAccepted  %+v", 202, o.Payload)
}

func (o *V2InstallClusterAccepted) GetPayload() *models.Cluster {
	return o.Payload
}

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

	o.Payload = new(models.Cluster)

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

	return nil
}

// NewV2InstallClusterBadRequest creates a V2InstallClusterBadRequest with default headers values
func NewV2InstallClusterBadRequest() *V2InstallClusterBadRequest {
	return &V2InstallClusterBadRequest{}
}

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

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

// IsSuccess returns true when this v2 install cluster bad request response has a 2xx status code
func (o *V2InstallClusterBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 install cluster bad request response has a 3xx status code
func (o *V2InstallClusterBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 install cluster bad request response has a 4xx status code
func (o *V2InstallClusterBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this v2 install cluster bad request response has a 5xx status code
func (o *V2InstallClusterBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 install cluster bad request response a status code equal to that given
func (o *V2InstallClusterBadRequest) IsCode(code int) bool {
	return code == 400
}

func (o *V2InstallClusterBadRequest) Error() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterBadRequest  %+v", 400, o.Payload)
}

func (o *V2InstallClusterBadRequest) String() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterBadRequest  %+v", 400, o.Payload)
}

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

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

// NewV2InstallClusterUnauthorized creates a V2InstallClusterUnauthorized with default headers values
func NewV2InstallClusterUnauthorized() *V2InstallClusterUnauthorized {
	return &V2InstallClusterUnauthorized{}
}

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

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

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

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

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

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

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

func (o *V2InstallClusterUnauthorized) Error() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterUnauthorized  %+v", 401, o.Payload)
}

func (o *V2InstallClusterUnauthorized) String() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewV2InstallClusterForbidden creates a V2InstallClusterForbidden with default headers values
func NewV2InstallClusterForbidden() *V2InstallClusterForbidden {
	return &V2InstallClusterForbidden{}
}

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

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

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

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

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

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

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

func (o *V2InstallClusterForbidden) Error() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterForbidden  %+v", 403, o.Payload)
}

func (o *V2InstallClusterForbidden) String() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterForbidden  %+v", 403, o.Payload)
}

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

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

// NewV2InstallClusterNotFound creates a V2InstallClusterNotFound with default headers values
func NewV2InstallClusterNotFound() *V2InstallClusterNotFound {
	return &V2InstallClusterNotFound{}
}

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

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

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

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

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

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

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

func (o *V2InstallClusterNotFound) Error() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterNotFound  %+v", 404, o.Payload)
}

func (o *V2InstallClusterNotFound) String() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterNotFound  %+v", 404, o.Payload)
}

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

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

// NewV2InstallClusterMethodNotAllowed creates a V2InstallClusterMethodNotAllowed with default headers values
func NewV2InstallClusterMethodNotAllowed() *V2InstallClusterMethodNotAllowed {
	return &V2InstallClusterMethodNotAllowed{}
}

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

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

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

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

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

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

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

func (o *V2InstallClusterMethodNotAllowed) Error() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterMethodNotAllowed  %+v", 405, o.Payload)
}

func (o *V2InstallClusterMethodNotAllowed) String() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterMethodNotAllowed  %+v", 405, o.Payload)
}

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

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

// NewV2InstallClusterConflict creates a V2InstallClusterConflict with default headers values
func NewV2InstallClusterConflict() *V2InstallClusterConflict {
	return &V2InstallClusterConflict{}
}

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

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

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

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

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

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

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

func (o *V2InstallClusterConflict) Error() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterConflict  %+v", 409, o.Payload)
}

func (o *V2InstallClusterConflict) String() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterConflict  %+v", 409, o.Payload)
}

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

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

// NewV2InstallClusterInternalServerError creates a V2InstallClusterInternalServerError with default headers values
func NewV2InstallClusterInternalServerError() *V2InstallClusterInternalServerError {
	return &V2InstallClusterInternalServerError{}
}

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

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

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

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

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

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

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

func (o *V2InstallClusterInternalServerError) Error() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterInternalServerError  %+v", 500, o.Payload)
}

func (o *V2InstallClusterInternalServerError) String() string {
	return fmt.Sprintf("[POST /v2/clusters/{cluster_id}/actions/install][%d] v2InstallClusterInternalServerError  %+v", 500, o.Payload)
}

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

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