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

package operations

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"encoding/json"
	"fmt"
	"io"

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

	"github.com/fiskerinc/cloud-services/pkg/ota_api/models"
)

// GetFleetNameReader is a Reader for the GetFleetName structure.
type GetFleetNameReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetFleetNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetFleetNameOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetFleetNameBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetFleetNameUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetFleetNameServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /fleet/{name}] GetFleetName", response, response.Code())
	}
}

// NewGetFleetNameOK creates a GetFleetNameOK with default headers values
func NewGetFleetNameOK() *GetFleetNameOK {
	return &GetFleetNameOK{}
}

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

OK
*/
type GetFleetNameOK struct {
	Payload *models.MongoFleet
}

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

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

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

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

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

// Code gets the status code for the get fleet name o k response
func (o *GetFleetNameOK) Code() int {
	return 200
}

func (o *GetFleetNameOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}][%d] getFleetNameOK %s", 200, payload)
}

func (o *GetFleetNameOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}][%d] getFleetNameOK %s", 200, payload)
}

func (o *GetFleetNameOK) GetPayload() *models.MongoFleet {
	return o.Payload
}

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

	o.Payload = new(models.MongoFleet)

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

	return nil
}

// NewGetFleetNameBadRequest creates a GetFleetNameBadRequest with default headers values
func NewGetFleetNameBadRequest() *GetFleetNameBadRequest {
	return &GetFleetNameBadRequest{}
}

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

Bad request
*/
type GetFleetNameBadRequest struct {
	Payload *models.CommonJSONError
}

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

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

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

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

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

// Code gets the status code for the get fleet name bad request response
func (o *GetFleetNameBadRequest) Code() int {
	return 400
}

func (o *GetFleetNameBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}][%d] getFleetNameBadRequest %s", 400, payload)
}

func (o *GetFleetNameBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}][%d] getFleetNameBadRequest %s", 400, payload)
}

func (o *GetFleetNameBadRequest) GetPayload() *models.CommonJSONError {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONError)

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

	return nil
}

// NewGetFleetNameUnauthorized creates a GetFleetNameUnauthorized with default headers values
func NewGetFleetNameUnauthorized() *GetFleetNameUnauthorized {
	return &GetFleetNameUnauthorized{}
}

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

Unauthorized
*/
type GetFleetNameUnauthorized struct {
	Payload *models.CommonJSONError
}

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

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

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

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

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

// Code gets the status code for the get fleet name unauthorized response
func (o *GetFleetNameUnauthorized) Code() int {
	return 401
}

func (o *GetFleetNameUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}][%d] getFleetNameUnauthorized %s", 401, payload)
}

func (o *GetFleetNameUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}][%d] getFleetNameUnauthorized %s", 401, payload)
}

func (o *GetFleetNameUnauthorized) GetPayload() *models.CommonJSONError {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONError)

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

	return nil
}

// NewGetFleetNameServiceUnavailable creates a GetFleetNameServiceUnavailable with default headers values
func NewGetFleetNameServiceUnavailable() *GetFleetNameServiceUnavailable {
	return &GetFleetNameServiceUnavailable{}
}

/*
GetFleetNameServiceUnavailable describes a response with status code 503, with default header values.

Service unavailable
*/
type GetFleetNameServiceUnavailable struct {
	Payload *models.CommonJSONError
}

// IsSuccess returns true when this get fleet name service unavailable response has a 2xx status code
func (o *GetFleetNameServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this get fleet name service unavailable response has a 3xx status code
func (o *GetFleetNameServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this get fleet name service unavailable response has a 4xx status code
func (o *GetFleetNameServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this get fleet name service unavailable response has a 5xx status code
func (o *GetFleetNameServiceUnavailable) IsServerError() bool {
	return true
}

// IsCode returns true when this get fleet name service unavailable response a status code equal to that given
func (o *GetFleetNameServiceUnavailable) IsCode(code int) bool {
	return code == 503
}

// Code gets the status code for the get fleet name service unavailable response
func (o *GetFleetNameServiceUnavailable) Code() int {
	return 503
}

func (o *GetFleetNameServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}][%d] getFleetNameServiceUnavailable %s", 503, payload)
}

func (o *GetFleetNameServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /fleet/{name}][%d] getFleetNameServiceUnavailable %s", 503, payload)
}

func (o *GetFleetNameServiceUnavailable) GetPayload() *models.CommonJSONError {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONError)

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

	return nil
}
