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

package workspaces

// 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/IBM-Cloud/power-go-client/power/models"
)

// V1WorkspacesGetallReader is a Reader for the V1WorkspacesGetall structure.
type V1WorkspacesGetallReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *V1WorkspacesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewV1WorkspacesGetallOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewV1WorkspacesGetallUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewV1WorkspacesGetallForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 429:
		result := NewV1WorkspacesGetallTooManyRequests()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewV1WorkspacesGetallInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /v1/workspaces] v1.workspaces.getall", response, response.Code())
	}
}

// NewV1WorkspacesGetallOK creates a V1WorkspacesGetallOK with default headers values
func NewV1WorkspacesGetallOK() *V1WorkspacesGetallOK {
	return &V1WorkspacesGetallOK{}
}

/*
V1WorkspacesGetallOK describes a response with status code 200, with default header values.

OK
*/
type V1WorkspacesGetallOK struct {
	Payload *models.Workspaces
}

// IsSuccess returns true when this v1 workspaces getall o k response has a 2xx status code
func (o *V1WorkspacesGetallOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this v1 workspaces getall o k response has a 3xx status code
func (o *V1WorkspacesGetallOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v1 workspaces getall o k response has a 4xx status code
func (o *V1WorkspacesGetallOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this v1 workspaces getall o k response has a 5xx status code
func (o *V1WorkspacesGetallOK) IsServerError() bool {
	return false
}

// IsCode returns true when this v1 workspaces getall o k response a status code equal to that given
func (o *V1WorkspacesGetallOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the v1 workspaces getall o k response
func (o *V1WorkspacesGetallOK) Code() int {
	return 200
}

func (o *V1WorkspacesGetallOK) Error() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallOK  %+v", 200, o.Payload)
}

func (o *V1WorkspacesGetallOK) String() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallOK  %+v", 200, o.Payload)
}

func (o *V1WorkspacesGetallOK) GetPayload() *models.Workspaces {
	return o.Payload
}

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

	o.Payload = new(models.Workspaces)

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

	return nil
}

// NewV1WorkspacesGetallUnauthorized creates a V1WorkspacesGetallUnauthorized with default headers values
func NewV1WorkspacesGetallUnauthorized() *V1WorkspacesGetallUnauthorized {
	return &V1WorkspacesGetallUnauthorized{}
}

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

Unauthorized
*/
type V1WorkspacesGetallUnauthorized struct {
	Payload *models.Error
}

// IsSuccess returns true when this v1 workspaces getall unauthorized response has a 2xx status code
func (o *V1WorkspacesGetallUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v1 workspaces getall unauthorized response has a 3xx status code
func (o *V1WorkspacesGetallUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v1 workspaces getall unauthorized response has a 4xx status code
func (o *V1WorkspacesGetallUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this v1 workspaces getall unauthorized response has a 5xx status code
func (o *V1WorkspacesGetallUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this v1 workspaces getall unauthorized response a status code equal to that given
func (o *V1WorkspacesGetallUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the v1 workspaces getall unauthorized response
func (o *V1WorkspacesGetallUnauthorized) Code() int {
	return 401
}

func (o *V1WorkspacesGetallUnauthorized) Error() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallUnauthorized  %+v", 401, o.Payload)
}

func (o *V1WorkspacesGetallUnauthorized) String() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewV1WorkspacesGetallForbidden creates a V1WorkspacesGetallForbidden with default headers values
func NewV1WorkspacesGetallForbidden() *V1WorkspacesGetallForbidden {
	return &V1WorkspacesGetallForbidden{}
}

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

Forbidden
*/
type V1WorkspacesGetallForbidden struct {
	Payload *models.Error
}

// IsSuccess returns true when this v1 workspaces getall forbidden response has a 2xx status code
func (o *V1WorkspacesGetallForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v1 workspaces getall forbidden response has a 3xx status code
func (o *V1WorkspacesGetallForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v1 workspaces getall forbidden response has a 4xx status code
func (o *V1WorkspacesGetallForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this v1 workspaces getall forbidden response has a 5xx status code
func (o *V1WorkspacesGetallForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this v1 workspaces getall forbidden response a status code equal to that given
func (o *V1WorkspacesGetallForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the v1 workspaces getall forbidden response
func (o *V1WorkspacesGetallForbidden) Code() int {
	return 403
}

func (o *V1WorkspacesGetallForbidden) Error() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallForbidden  %+v", 403, o.Payload)
}

func (o *V1WorkspacesGetallForbidden) String() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallForbidden  %+v", 403, o.Payload)
}

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

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

// NewV1WorkspacesGetallTooManyRequests creates a V1WorkspacesGetallTooManyRequests with default headers values
func NewV1WorkspacesGetallTooManyRequests() *V1WorkspacesGetallTooManyRequests {
	return &V1WorkspacesGetallTooManyRequests{}
}

/*
V1WorkspacesGetallTooManyRequests describes a response with status code 429, with default header values.

Too Many Requests
*/
type V1WorkspacesGetallTooManyRequests struct {
	Payload *models.Error
}

// IsSuccess returns true when this v1 workspaces getall too many requests response has a 2xx status code
func (o *V1WorkspacesGetallTooManyRequests) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v1 workspaces getall too many requests response has a 3xx status code
func (o *V1WorkspacesGetallTooManyRequests) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v1 workspaces getall too many requests response has a 4xx status code
func (o *V1WorkspacesGetallTooManyRequests) IsClientError() bool {
	return true
}

// IsServerError returns true when this v1 workspaces getall too many requests response has a 5xx status code
func (o *V1WorkspacesGetallTooManyRequests) IsServerError() bool {
	return false
}

// IsCode returns true when this v1 workspaces getall too many requests response a status code equal to that given
func (o *V1WorkspacesGetallTooManyRequests) IsCode(code int) bool {
	return code == 429
}

// Code gets the status code for the v1 workspaces getall too many requests response
func (o *V1WorkspacesGetallTooManyRequests) Code() int {
	return 429
}

func (o *V1WorkspacesGetallTooManyRequests) Error() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallTooManyRequests  %+v", 429, o.Payload)
}

func (o *V1WorkspacesGetallTooManyRequests) String() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallTooManyRequests  %+v", 429, o.Payload)
}

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

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

// NewV1WorkspacesGetallInternalServerError creates a V1WorkspacesGetallInternalServerError with default headers values
func NewV1WorkspacesGetallInternalServerError() *V1WorkspacesGetallInternalServerError {
	return &V1WorkspacesGetallInternalServerError{}
}

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

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

// IsSuccess returns true when this v1 workspaces getall internal server error response has a 2xx status code
func (o *V1WorkspacesGetallInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v1 workspaces getall internal server error response has a 3xx status code
func (o *V1WorkspacesGetallInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v1 workspaces getall internal server error response has a 4xx status code
func (o *V1WorkspacesGetallInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this v1 workspaces getall internal server error response has a 5xx status code
func (o *V1WorkspacesGetallInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this v1 workspaces getall internal server error response a status code equal to that given
func (o *V1WorkspacesGetallInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the v1 workspaces getall internal server error response
func (o *V1WorkspacesGetallInternalServerError) Code() int {
	return 500
}

func (o *V1WorkspacesGetallInternalServerError) Error() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallInternalServerError  %+v", 500, o.Payload)
}

func (o *V1WorkspacesGetallInternalServerError) String() string {
	return fmt.Sprintf("[GET /v1/workspaces][%d] v1WorkspacesGetallInternalServerError  %+v", 500, o.Payload)
}

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

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