// Code generated by go-swagger; DO NOT EDIT.

package p_cloud_s_a_p

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

	strfmt "github.com/go-openapi/strfmt"

	models "github.com/IBM-Cloud/power-go-client/power/models"
)

// PcloudSapPostReader is a Reader for the PcloudSapPost structure.
type PcloudSapPostReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PcloudSapPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {

	case 200:
		result := NewPcloudSapPostOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	case 201:
		result := NewPcloudSapPostCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	case 202:
		result := NewPcloudSapPostAccepted()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	case 400:
		result := NewPcloudSapPostBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	case 409:
		result := NewPcloudSapPostConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	case 422:
		result := NewPcloudSapPostUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	case 500:
		result := NewPcloudSapPostInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewPcloudSapPostOK creates a PcloudSapPostOK with default headers values
func NewPcloudSapPostOK() *PcloudSapPostOK {
	return &PcloudSapPostOK{}
}

/*PcloudSapPostOK handles this case with default header values.

OK
*/
type PcloudSapPostOK struct {
	Payload models.PVMInstanceList
}

func (o *PcloudSapPostOK) Error() string {
	return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostOK  %+v", 200, o.Payload)
}

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

// NewPcloudSapPostCreated creates a PcloudSapPostCreated with default headers values
func NewPcloudSapPostCreated() *PcloudSapPostCreated {
	return &PcloudSapPostCreated{}
}

/*PcloudSapPostCreated handles this case with default header values.

Created
*/
type PcloudSapPostCreated struct {
	Payload models.PVMInstanceList
}

func (o *PcloudSapPostCreated) Error() string {
	return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostCreated  %+v", 201, o.Payload)
}

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

// NewPcloudSapPostAccepted creates a PcloudSapPostAccepted with default headers values
func NewPcloudSapPostAccepted() *PcloudSapPostAccepted {
	return &PcloudSapPostAccepted{}
}

/*PcloudSapPostAccepted handles this case with default header values.

Accepted
*/
type PcloudSapPostAccepted struct {
	Payload models.PVMInstanceList
}

func (o *PcloudSapPostAccepted) Error() string {
	return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostAccepted  %+v", 202, o.Payload)
}

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

// NewPcloudSapPostBadRequest creates a PcloudSapPostBadRequest with default headers values
func NewPcloudSapPostBadRequest() *PcloudSapPostBadRequest {
	return &PcloudSapPostBadRequest{}
}

/*PcloudSapPostBadRequest handles this case with default header values.

Bad Request
*/
type PcloudSapPostBadRequest struct {
	Payload *models.Error
}

func (o *PcloudSapPostBadRequest) Error() string {
	return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostBadRequest  %+v", 400, o.Payload)
}

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

// NewPcloudSapPostConflict creates a PcloudSapPostConflict with default headers values
func NewPcloudSapPostConflict() *PcloudSapPostConflict {
	return &PcloudSapPostConflict{}
}

/*PcloudSapPostConflict handles this case with default header values.

Conflict
*/
type PcloudSapPostConflict struct {
	Payload *models.Error
}

func (o *PcloudSapPostConflict) Error() string {
	return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostConflict  %+v", 409, o.Payload)
}

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

// NewPcloudSapPostUnprocessableEntity creates a PcloudSapPostUnprocessableEntity with default headers values
func NewPcloudSapPostUnprocessableEntity() *PcloudSapPostUnprocessableEntity {
	return &PcloudSapPostUnprocessableEntity{}
}

/*PcloudSapPostUnprocessableEntity handles this case with default header values.

Unprocessable Entity
*/
type PcloudSapPostUnprocessableEntity struct {
	Payload *models.Error
}

func (o *PcloudSapPostUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostUnprocessableEntity  %+v", 422, o.Payload)
}

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

// NewPcloudSapPostInternalServerError creates a PcloudSapPostInternalServerError with default headers values
func NewPcloudSapPostInternalServerError() *PcloudSapPostInternalServerError {
	return &PcloudSapPostInternalServerError{}
}

/*PcloudSapPostInternalServerError handles this case with default header values.

Internal Server Error
*/
type PcloudSapPostInternalServerError struct {
	Payload *models.Error
}

func (o *PcloudSapPostInternalServerError) Error() string {
	return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostInternalServerError  %+v", 500, o.Payload)
}

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