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

// V2RegisterClusterReader is a Reader for the V2RegisterCluster structure.
type V2RegisterClusterReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *V2RegisterClusterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 201:
		result := NewV2RegisterClusterCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewV2RegisterClusterBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewV2RegisterClusterUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewV2RegisterClusterForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 405:
		result := NewV2RegisterClusterMethodNotAllowed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewV2RegisterClusterInternalServerError()
		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())
	}
}

// NewV2RegisterClusterCreated creates a V2RegisterClusterCreated with default headers values
func NewV2RegisterClusterCreated() *V2RegisterClusterCreated {
	return &V2RegisterClusterCreated{}
}

/*
V2RegisterClusterCreated describes a response with status code 201, with default header values.

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

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

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

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

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

// IsCode returns true when this v2 register cluster created response a status code equal to that given
func (o *V2RegisterClusterCreated) IsCode(code int) bool {
	return code == 201
}

func (o *V2RegisterClusterCreated) Error() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterCreated  %+v", 201, o.Payload)
}

func (o *V2RegisterClusterCreated) String() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterCreated  %+v", 201, o.Payload)
}

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

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

// NewV2RegisterClusterBadRequest creates a V2RegisterClusterBadRequest with default headers values
func NewV2RegisterClusterBadRequest() *V2RegisterClusterBadRequest {
	return &V2RegisterClusterBadRequest{}
}

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

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

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

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

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

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

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

func (o *V2RegisterClusterBadRequest) Error() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterBadRequest  %+v", 400, o.Payload)
}

func (o *V2RegisterClusterBadRequest) String() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterBadRequest  %+v", 400, o.Payload)
}

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

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

// NewV2RegisterClusterUnauthorized creates a V2RegisterClusterUnauthorized with default headers values
func NewV2RegisterClusterUnauthorized() *V2RegisterClusterUnauthorized {
	return &V2RegisterClusterUnauthorized{}
}

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

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

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

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

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

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

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

func (o *V2RegisterClusterUnauthorized) Error() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterUnauthorized  %+v", 401, o.Payload)
}

func (o *V2RegisterClusterUnauthorized) String() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewV2RegisterClusterForbidden creates a V2RegisterClusterForbidden with default headers values
func NewV2RegisterClusterForbidden() *V2RegisterClusterForbidden {
	return &V2RegisterClusterForbidden{}
}

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

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

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

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

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

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

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

func (o *V2RegisterClusterForbidden) Error() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterForbidden  %+v", 403, o.Payload)
}

func (o *V2RegisterClusterForbidden) String() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterForbidden  %+v", 403, o.Payload)
}

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

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

// NewV2RegisterClusterMethodNotAllowed creates a V2RegisterClusterMethodNotAllowed with default headers values
func NewV2RegisterClusterMethodNotAllowed() *V2RegisterClusterMethodNotAllowed {
	return &V2RegisterClusterMethodNotAllowed{}
}

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

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

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

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

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

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

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

func (o *V2RegisterClusterMethodNotAllowed) Error() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterMethodNotAllowed  %+v", 405, o.Payload)
}

func (o *V2RegisterClusterMethodNotAllowed) String() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterMethodNotAllowed  %+v", 405, o.Payload)
}

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

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

// NewV2RegisterClusterInternalServerError creates a V2RegisterClusterInternalServerError with default headers values
func NewV2RegisterClusterInternalServerError() *V2RegisterClusterInternalServerError {
	return &V2RegisterClusterInternalServerError{}
}

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

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

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

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

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

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

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

func (o *V2RegisterClusterInternalServerError) Error() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterInternalServerError  %+v", 500, o.Payload)
}

func (o *V2RegisterClusterInternalServerError) String() string {
	return fmt.Sprintf("[POST /v2/clusters][%d] v2RegisterClusterInternalServerError  %+v", 500, o.Payload)
}

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

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