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

package controller

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

	apiserver_params "github.com/cloudbase/garm/apiserver/params"
	garm_params "github.com/cloudbase/garm/params"
)

// UpdateControllerReader is a Reader for the UpdateController structure.
type UpdateControllerReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UpdateControllerReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewUpdateControllerOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewUpdateControllerBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /controller] UpdateController", response, response.Code())
	}
}

// NewUpdateControllerOK creates a UpdateControllerOK with default headers values
func NewUpdateControllerOK() *UpdateControllerOK {
	return &UpdateControllerOK{}
}

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

ControllerInfo
*/
type UpdateControllerOK struct {
	Payload garm_params.ControllerInfo
}

// IsSuccess returns true when this update controller o k response has a 2xx status code
func (o *UpdateControllerOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this update controller o k response has a 3xx status code
func (o *UpdateControllerOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this update controller o k response has a 4xx status code
func (o *UpdateControllerOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this update controller o k response has a 5xx status code
func (o *UpdateControllerOK) IsServerError() bool {
	return false
}

// IsCode returns true when this update controller o k response a status code equal to that given
func (o *UpdateControllerOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the update controller o k response
func (o *UpdateControllerOK) Code() int {
	return 200
}

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

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

func (o *UpdateControllerOK) GetPayload() garm_params.ControllerInfo {
	return o.Payload
}

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

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

	return nil
}

// NewUpdateControllerBadRequest creates a UpdateControllerBadRequest with default headers values
func NewUpdateControllerBadRequest() *UpdateControllerBadRequest {
	return &UpdateControllerBadRequest{}
}

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

APIErrorResponse
*/
type UpdateControllerBadRequest struct {
	Payload apiserver_params.APIErrorResponse
}

// IsSuccess returns true when this update controller bad request response has a 2xx status code
func (o *UpdateControllerBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this update controller bad request response has a 3xx status code
func (o *UpdateControllerBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this update controller bad request response has a 4xx status code
func (o *UpdateControllerBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this update controller bad request response has a 5xx status code
func (o *UpdateControllerBadRequest) IsServerError() bool {
	return false
}

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

// Code gets the status code for the update controller bad request response
func (o *UpdateControllerBadRequest) Code() int {
	return 400
}

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

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

func (o *UpdateControllerBadRequest) GetPayload() apiserver_params.APIErrorResponse {
	return o.Payload
}

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

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

	return nil
}
