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

package p_cloud_networks

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

// PcloudNetworksPortsGetallReader is a Reader for the PcloudNetworksPortsGetall structure.
type PcloudNetworksPortsGetallReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PcloudNetworksPortsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPcloudNetworksPortsGetallOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPcloudNetworksPortsGetallBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPcloudNetworksPortsGetallUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPcloudNetworksPortsGetallForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPcloudNetworksPortsGetallNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPcloudNetworksPortsGetallInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports] pcloud.networks.ports.getall", response, response.Code())
	}
}

// NewPcloudNetworksPortsGetallOK creates a PcloudNetworksPortsGetallOK with default headers values
func NewPcloudNetworksPortsGetallOK() *PcloudNetworksPortsGetallOK {
	return &PcloudNetworksPortsGetallOK{}
}

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

OK
*/
type PcloudNetworksPortsGetallOK struct {
	Payload *models.NetworkPorts
}

// IsSuccess returns true when this pcloud networks ports getall o k response has a 2xx status code
func (o *PcloudNetworksPortsGetallOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this pcloud networks ports getall o k response has a 3xx status code
func (o *PcloudNetworksPortsGetallOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this pcloud networks ports getall o k response has a 4xx status code
func (o *PcloudNetworksPortsGetallOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this pcloud networks ports getall o k response has a 5xx status code
func (o *PcloudNetworksPortsGetallOK) IsServerError() bool {
	return false
}

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

// Code gets the status code for the pcloud networks ports getall o k response
func (o *PcloudNetworksPortsGetallOK) Code() int {
	return 200
}

func (o *PcloudNetworksPortsGetallOK) Error() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallOK  %+v", 200, o.Payload)
}

func (o *PcloudNetworksPortsGetallOK) String() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallOK  %+v", 200, o.Payload)
}

func (o *PcloudNetworksPortsGetallOK) GetPayload() *models.NetworkPorts {
	return o.Payload
}

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

	o.Payload = new(models.NetworkPorts)

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

	return nil
}

// NewPcloudNetworksPortsGetallBadRequest creates a PcloudNetworksPortsGetallBadRequest with default headers values
func NewPcloudNetworksPortsGetallBadRequest() *PcloudNetworksPortsGetallBadRequest {
	return &PcloudNetworksPortsGetallBadRequest{}
}

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

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

// IsSuccess returns true when this pcloud networks ports getall bad request response has a 2xx status code
func (o *PcloudNetworksPortsGetallBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this pcloud networks ports getall bad request response has a 3xx status code
func (o *PcloudNetworksPortsGetallBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this pcloud networks ports getall bad request response has a 4xx status code
func (o *PcloudNetworksPortsGetallBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this pcloud networks ports getall bad request response has a 5xx status code
func (o *PcloudNetworksPortsGetallBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this pcloud networks ports getall bad request response a status code equal to that given
func (o *PcloudNetworksPortsGetallBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the pcloud networks ports getall bad request response
func (o *PcloudNetworksPortsGetallBadRequest) Code() int {
	return 400
}

func (o *PcloudNetworksPortsGetallBadRequest) Error() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallBadRequest  %+v", 400, o.Payload)
}

func (o *PcloudNetworksPortsGetallBadRequest) String() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallBadRequest  %+v", 400, o.Payload)
}

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

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

// NewPcloudNetworksPortsGetallUnauthorized creates a PcloudNetworksPortsGetallUnauthorized with default headers values
func NewPcloudNetworksPortsGetallUnauthorized() *PcloudNetworksPortsGetallUnauthorized {
	return &PcloudNetworksPortsGetallUnauthorized{}
}

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

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

// IsSuccess returns true when this pcloud networks ports getall unauthorized response has a 2xx status code
func (o *PcloudNetworksPortsGetallUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this pcloud networks ports getall unauthorized response has a 3xx status code
func (o *PcloudNetworksPortsGetallUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this pcloud networks ports getall unauthorized response has a 4xx status code
func (o *PcloudNetworksPortsGetallUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this pcloud networks ports getall unauthorized response has a 5xx status code
func (o *PcloudNetworksPortsGetallUnauthorized) IsServerError() bool {
	return false
}

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

// Code gets the status code for the pcloud networks ports getall unauthorized response
func (o *PcloudNetworksPortsGetallUnauthorized) Code() int {
	return 401
}

func (o *PcloudNetworksPortsGetallUnauthorized) Error() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallUnauthorized  %+v", 401, o.Payload)
}

func (o *PcloudNetworksPortsGetallUnauthorized) String() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewPcloudNetworksPortsGetallForbidden creates a PcloudNetworksPortsGetallForbidden with default headers values
func NewPcloudNetworksPortsGetallForbidden() *PcloudNetworksPortsGetallForbidden {
	return &PcloudNetworksPortsGetallForbidden{}
}

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

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

// IsSuccess returns true when this pcloud networks ports getall forbidden response has a 2xx status code
func (o *PcloudNetworksPortsGetallForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this pcloud networks ports getall forbidden response has a 3xx status code
func (o *PcloudNetworksPortsGetallForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this pcloud networks ports getall forbidden response has a 4xx status code
func (o *PcloudNetworksPortsGetallForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this pcloud networks ports getall forbidden response has a 5xx status code
func (o *PcloudNetworksPortsGetallForbidden) IsServerError() bool {
	return false
}

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

// Code gets the status code for the pcloud networks ports getall forbidden response
func (o *PcloudNetworksPortsGetallForbidden) Code() int {
	return 403
}

func (o *PcloudNetworksPortsGetallForbidden) Error() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallForbidden  %+v", 403, o.Payload)
}

func (o *PcloudNetworksPortsGetallForbidden) String() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallForbidden  %+v", 403, o.Payload)
}

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

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

// NewPcloudNetworksPortsGetallNotFound creates a PcloudNetworksPortsGetallNotFound with default headers values
func NewPcloudNetworksPortsGetallNotFound() *PcloudNetworksPortsGetallNotFound {
	return &PcloudNetworksPortsGetallNotFound{}
}

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

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

// IsSuccess returns true when this pcloud networks ports getall not found response has a 2xx status code
func (o *PcloudNetworksPortsGetallNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this pcloud networks ports getall not found response has a 3xx status code
func (o *PcloudNetworksPortsGetallNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this pcloud networks ports getall not found response has a 4xx status code
func (o *PcloudNetworksPortsGetallNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this pcloud networks ports getall not found response has a 5xx status code
func (o *PcloudNetworksPortsGetallNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this pcloud networks ports getall not found response a status code equal to that given
func (o *PcloudNetworksPortsGetallNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the pcloud networks ports getall not found response
func (o *PcloudNetworksPortsGetallNotFound) Code() int {
	return 404
}

func (o *PcloudNetworksPortsGetallNotFound) Error() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallNotFound  %+v", 404, o.Payload)
}

func (o *PcloudNetworksPortsGetallNotFound) String() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallNotFound  %+v", 404, o.Payload)
}

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

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

// NewPcloudNetworksPortsGetallInternalServerError creates a PcloudNetworksPortsGetallInternalServerError with default headers values
func NewPcloudNetworksPortsGetallInternalServerError() *PcloudNetworksPortsGetallInternalServerError {
	return &PcloudNetworksPortsGetallInternalServerError{}
}

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

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

// IsSuccess returns true when this pcloud networks ports getall internal server error response has a 2xx status code
func (o *PcloudNetworksPortsGetallInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this pcloud networks ports getall internal server error response has a 3xx status code
func (o *PcloudNetworksPortsGetallInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this pcloud networks ports getall internal server error response has a 4xx status code
func (o *PcloudNetworksPortsGetallInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this pcloud networks ports getall internal server error response has a 5xx status code
func (o *PcloudNetworksPortsGetallInternalServerError) IsServerError() bool {
	return true
}

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

// Code gets the status code for the pcloud networks ports getall internal server error response
func (o *PcloudNetworksPortsGetallInternalServerError) Code() int {
	return 500
}

func (o *PcloudNetworksPortsGetallInternalServerError) Error() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallInternalServerError  %+v", 500, o.Payload)
}

func (o *PcloudNetworksPortsGetallInternalServerError) String() string {
	return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallInternalServerError  %+v", 500, o.Payload)
}

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

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