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

package service_instances

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

// ServiceInstanceGetReader is a Reader for the ServiceInstanceGet structure.
type ServiceInstanceGetReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *ServiceInstanceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewServiceInstanceGetOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewServiceInstanceGetBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewServiceInstanceGetUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewServiceInstanceGetForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewServiceInstanceGetNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /v2/service_instances/{instance_id}] serviceInstance.get", response, response.Code())
	}
}

// NewServiceInstanceGetOK creates a ServiceInstanceGetOK with default headers values
func NewServiceInstanceGetOK() *ServiceInstanceGetOK {
	return &ServiceInstanceGetOK{}
}

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

OK
*/
type ServiceInstanceGetOK struct {
	Payload *models.ServiceInstanceResource
}

// IsSuccess returns true when this service instance get o k response has a 2xx status code
func (o *ServiceInstanceGetOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this service instance get o k response has a 3xx status code
func (o *ServiceInstanceGetOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this service instance get o k response has a 4xx status code
func (o *ServiceInstanceGetOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this service instance get o k response has a 5xx status code
func (o *ServiceInstanceGetOK) IsServerError() bool {
	return false
}

// IsCode returns true when this service instance get o k response a status code equal to that given
func (o *ServiceInstanceGetOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the service instance get o k response
func (o *ServiceInstanceGetOK) Code() int {
	return 200
}

func (o *ServiceInstanceGetOK) Error() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetOK  %+v", 200, o.Payload)
}

func (o *ServiceInstanceGetOK) String() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetOK  %+v", 200, o.Payload)
}

func (o *ServiceInstanceGetOK) GetPayload() *models.ServiceInstanceResource {
	return o.Payload
}

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

	o.Payload = new(models.ServiceInstanceResource)

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

	return nil
}

// NewServiceInstanceGetBadRequest creates a ServiceInstanceGetBadRequest with default headers values
func NewServiceInstanceGetBadRequest() *ServiceInstanceGetBadRequest {
	return &ServiceInstanceGetBadRequest{}
}

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

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

// IsSuccess returns true when this service instance get bad request response has a 2xx status code
func (o *ServiceInstanceGetBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this service instance get bad request response has a 3xx status code
func (o *ServiceInstanceGetBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this service instance get bad request response has a 4xx status code
func (o *ServiceInstanceGetBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this service instance get bad request response has a 5xx status code
func (o *ServiceInstanceGetBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this service instance get bad request response a status code equal to that given
func (o *ServiceInstanceGetBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the service instance get bad request response
func (o *ServiceInstanceGetBadRequest) Code() int {
	return 400
}

func (o *ServiceInstanceGetBadRequest) Error() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetBadRequest  %+v", 400, o.Payload)
}

func (o *ServiceInstanceGetBadRequest) String() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetBadRequest  %+v", 400, o.Payload)
}

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

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

// NewServiceInstanceGetUnauthorized creates a ServiceInstanceGetUnauthorized with default headers values
func NewServiceInstanceGetUnauthorized() *ServiceInstanceGetUnauthorized {
	return &ServiceInstanceGetUnauthorized{}
}

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

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

// IsSuccess returns true when this service instance get unauthorized response has a 2xx status code
func (o *ServiceInstanceGetUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this service instance get unauthorized response has a 3xx status code
func (o *ServiceInstanceGetUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this service instance get unauthorized response has a 4xx status code
func (o *ServiceInstanceGetUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this service instance get unauthorized response has a 5xx status code
func (o *ServiceInstanceGetUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this service instance get unauthorized response a status code equal to that given
func (o *ServiceInstanceGetUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the service instance get unauthorized response
func (o *ServiceInstanceGetUnauthorized) Code() int {
	return 401
}

func (o *ServiceInstanceGetUnauthorized) Error() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetUnauthorized  %+v", 401, o.Payload)
}

func (o *ServiceInstanceGetUnauthorized) String() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewServiceInstanceGetForbidden creates a ServiceInstanceGetForbidden with default headers values
func NewServiceInstanceGetForbidden() *ServiceInstanceGetForbidden {
	return &ServiceInstanceGetForbidden{}
}

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

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

// IsSuccess returns true when this service instance get forbidden response has a 2xx status code
func (o *ServiceInstanceGetForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this service instance get forbidden response has a 3xx status code
func (o *ServiceInstanceGetForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this service instance get forbidden response has a 4xx status code
func (o *ServiceInstanceGetForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this service instance get forbidden response has a 5xx status code
func (o *ServiceInstanceGetForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this service instance get forbidden response a status code equal to that given
func (o *ServiceInstanceGetForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the service instance get forbidden response
func (o *ServiceInstanceGetForbidden) Code() int {
	return 403
}

func (o *ServiceInstanceGetForbidden) Error() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetForbidden  %+v", 403, o.Payload)
}

func (o *ServiceInstanceGetForbidden) String() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetForbidden  %+v", 403, o.Payload)
}

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

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

// NewServiceInstanceGetNotFound creates a ServiceInstanceGetNotFound with default headers values
func NewServiceInstanceGetNotFound() *ServiceInstanceGetNotFound {
	return &ServiceInstanceGetNotFound{}
}

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

Not Found
*/
type ServiceInstanceGetNotFound struct {
	Payload *models.Error
}

// IsSuccess returns true when this service instance get not found response has a 2xx status code
func (o *ServiceInstanceGetNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this service instance get not found response has a 3xx status code
func (o *ServiceInstanceGetNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this service instance get not found response has a 4xx status code
func (o *ServiceInstanceGetNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this service instance get not found response has a 5xx status code
func (o *ServiceInstanceGetNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this service instance get not found response a status code equal to that given
func (o *ServiceInstanceGetNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the service instance get not found response
func (o *ServiceInstanceGetNotFound) Code() int {
	return 404
}

func (o *ServiceInstanceGetNotFound) Error() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetNotFound  %+v", 404, o.Payload)
}

func (o *ServiceInstanceGetNotFound) String() string {
	return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetNotFound  %+v", 404, o.Payload)
}

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

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