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

// V2GetCredentialsReader is a Reader for the V2GetCredentials structure.
type V2GetCredentialsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *V2GetCredentialsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewV2GetCredentialsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewV2GetCredentialsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewV2GetCredentialsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewV2GetCredentialsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 405:
		result := NewV2GetCredentialsMethodNotAllowed()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewV2GetCredentialsConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewV2GetCredentialsInternalServerError()
		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())
	}
}

// NewV2GetCredentialsOK creates a V2GetCredentialsOK with default headers values
func NewV2GetCredentialsOK() *V2GetCredentialsOK {
	return &V2GetCredentialsOK{}
}

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

Success.
*/
type V2GetCredentialsOK struct {
	Payload *models.Credentials
}

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

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

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

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

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

func (o *V2GetCredentialsOK) Error() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsOK  %+v", 200, o.Payload)
}

func (o *V2GetCredentialsOK) String() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsOK  %+v", 200, o.Payload)
}

func (o *V2GetCredentialsOK) GetPayload() *models.Credentials {
	return o.Payload
}

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

	o.Payload = new(models.Credentials)

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

	return nil
}

// NewV2GetCredentialsUnauthorized creates a V2GetCredentialsUnauthorized with default headers values
func NewV2GetCredentialsUnauthorized() *V2GetCredentialsUnauthorized {
	return &V2GetCredentialsUnauthorized{}
}

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

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

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

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

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

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

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

func (o *V2GetCredentialsUnauthorized) Error() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsUnauthorized  %+v", 401, o.Payload)
}

func (o *V2GetCredentialsUnauthorized) String() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewV2GetCredentialsForbidden creates a V2GetCredentialsForbidden with default headers values
func NewV2GetCredentialsForbidden() *V2GetCredentialsForbidden {
	return &V2GetCredentialsForbidden{}
}

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

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

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

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

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

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

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

func (o *V2GetCredentialsForbidden) Error() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsForbidden  %+v", 403, o.Payload)
}

func (o *V2GetCredentialsForbidden) String() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsForbidden  %+v", 403, o.Payload)
}

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

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

// NewV2GetCredentialsNotFound creates a V2GetCredentialsNotFound with default headers values
func NewV2GetCredentialsNotFound() *V2GetCredentialsNotFound {
	return &V2GetCredentialsNotFound{}
}

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

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

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

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

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

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

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

func (o *V2GetCredentialsNotFound) Error() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsNotFound  %+v", 404, o.Payload)
}

func (o *V2GetCredentialsNotFound) String() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsNotFound  %+v", 404, o.Payload)
}

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

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

// NewV2GetCredentialsMethodNotAllowed creates a V2GetCredentialsMethodNotAllowed with default headers values
func NewV2GetCredentialsMethodNotAllowed() *V2GetCredentialsMethodNotAllowed {
	return &V2GetCredentialsMethodNotAllowed{}
}

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

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

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

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

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

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

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

func (o *V2GetCredentialsMethodNotAllowed) Error() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsMethodNotAllowed  %+v", 405, o.Payload)
}

func (o *V2GetCredentialsMethodNotAllowed) String() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsMethodNotAllowed  %+v", 405, o.Payload)
}

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

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

// NewV2GetCredentialsConflict creates a V2GetCredentialsConflict with default headers values
func NewV2GetCredentialsConflict() *V2GetCredentialsConflict {
	return &V2GetCredentialsConflict{}
}

/*
V2GetCredentialsConflict describes a response with status code 409, with default header values.

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

// IsSuccess returns true when this v2 get credentials conflict response has a 2xx status code
func (o *V2GetCredentialsConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this v2 get credentials conflict response has a 3xx status code
func (o *V2GetCredentialsConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this v2 get credentials conflict response has a 4xx status code
func (o *V2GetCredentialsConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this v2 get credentials conflict response has a 5xx status code
func (o *V2GetCredentialsConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this v2 get credentials conflict response a status code equal to that given
func (o *V2GetCredentialsConflict) IsCode(code int) bool {
	return code == 409
}

func (o *V2GetCredentialsConflict) Error() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsConflict  %+v", 409, o.Payload)
}

func (o *V2GetCredentialsConflict) String() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsConflict  %+v", 409, o.Payload)
}

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

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

// NewV2GetCredentialsInternalServerError creates a V2GetCredentialsInternalServerError with default headers values
func NewV2GetCredentialsInternalServerError() *V2GetCredentialsInternalServerError {
	return &V2GetCredentialsInternalServerError{}
}

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

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

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

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

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

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

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

func (o *V2GetCredentialsInternalServerError) Error() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsInternalServerError  %+v", 500, o.Payload)
}

func (o *V2GetCredentialsInternalServerError) String() string {
	return fmt.Sprintf("[GET /v2/clusters/{cluster_id}/credentials][%d] v2GetCredentialsInternalServerError  %+v", 500, o.Payload)
}

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

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