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

// PutFleetNameReader is a Reader for the PutFleetName structure.
type PutFleetNameReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutFleetNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutFleetNameOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutFleetNameBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutFleetNameUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPutFleetNameServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /fleet/{name}] PutFleetName", response, response.Code())
	}
}

// NewPutFleetNameOK creates a PutFleetNameOK with default headers values
func NewPutFleetNameOK() *PutFleetNameOK {
	return &PutFleetNameOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutFleetNameBadRequest creates a PutFleetNameBadRequest with default headers values
func NewPutFleetNameBadRequest() *PutFleetNameBadRequest {
	return &PutFleetNameBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutFleetNameUnauthorized creates a PutFleetNameUnauthorized with default headers values
func NewPutFleetNameUnauthorized() *PutFleetNameUnauthorized {
	return &PutFleetNameUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPutFleetNameServiceUnavailable creates a PutFleetNameServiceUnavailable with default headers values
func NewPutFleetNameServiceUnavailable() *PutFleetNameServiceUnavailable {
	return &PutFleetNameServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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