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

// V2CancelInstallationReader is a Reader for the V2CancelInstallation structure.
type V2CancelInstallationReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *V2CancelInstallationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 202:
		result := NewV2CancelInstallationAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewV2CancelInstallationUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewV2CancelInstallationForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewV2CancelInstallationNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 405:
		result := NewV2CancelInstallationMethodNotAllowed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewV2CancelInstallationConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewV2CancelInstallationInternalServerError()
		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())
	}
}

// NewV2CancelInstallationAccepted creates a V2CancelInstallationAccepted with default headers values
func NewV2CancelInstallationAccepted() *V2CancelInstallationAccepted {
	return &V2CancelInstallationAccepted{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewV2CancelInstallationUnauthorized creates a V2CancelInstallationUnauthorized with default headers values
func NewV2CancelInstallationUnauthorized() *V2CancelInstallationUnauthorized {
	return &V2CancelInstallationUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewV2CancelInstallationForbidden creates a V2CancelInstallationForbidden with default headers values
func NewV2CancelInstallationForbidden() *V2CancelInstallationForbidden {
	return &V2CancelInstallationForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewV2CancelInstallationNotFound creates a V2CancelInstallationNotFound with default headers values
func NewV2CancelInstallationNotFound() *V2CancelInstallationNotFound {
	return &V2CancelInstallationNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewV2CancelInstallationMethodNotAllowed creates a V2CancelInstallationMethodNotAllowed with default headers values
func NewV2CancelInstallationMethodNotAllowed() *V2CancelInstallationMethodNotAllowed {
	return &V2CancelInstallationMethodNotAllowed{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewV2CancelInstallationConflict creates a V2CancelInstallationConflict with default headers values
func NewV2CancelInstallationConflict() *V2CancelInstallationConflict {
	return &V2CancelInstallationConflict{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewV2CancelInstallationInternalServerError creates a V2CancelInstallationInternalServerError with default headers values
func NewV2CancelInstallationInternalServerError() *V2CancelInstallationInternalServerError {
	return &V2CancelInstallationInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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