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

package api_keys

// 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/grafana/grafana-openapi-client-go/models"
)

// AddAPIkeyReader is a Reader for the AddAPIkey structure.
type AddAPIkeyReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *AddAPIkeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 410:
		result := NewAddAPIkeyGone()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /auth/keys] addAPIkey", response, response.Code())
	}
}

// NewAddAPIkeyGone creates a AddAPIkeyGone with default headers values
func NewAddAPIkeyGone() *AddAPIkeyGone {
	return &AddAPIkeyGone{}
}

/*
AddAPIkeyGone describes a response with status code 410, with default header values.

GoneError is returned when the requested endpoint was removed.
*/
type AddAPIkeyGone struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this add a p ikey gone response has a 2xx status code
func (o *AddAPIkeyGone) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this add a p ikey gone response has a 3xx status code
func (o *AddAPIkeyGone) IsRedirect() bool {
	return false
}

// IsClientError returns true when this add a p ikey gone response has a 4xx status code
func (o *AddAPIkeyGone) IsClientError() bool {
	return true
}

// IsServerError returns true when this add a p ikey gone response has a 5xx status code
func (o *AddAPIkeyGone) IsServerError() bool {
	return false
}

// IsCode returns true when this add a p ikey gone response a status code equal to that given
func (o *AddAPIkeyGone) IsCode(code int) bool {
	return code == 410
}

// Code gets the status code for the add a p ikey gone response
func (o *AddAPIkeyGone) Code() int {
	return 410
}

func (o *AddAPIkeyGone) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /auth/keys][%d] addAPIkeyGone %s", 410, payload)
}

func (o *AddAPIkeyGone) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /auth/keys][%d] addAPIkeyGone %s", 410, payload)
}

func (o *AddAPIkeyGone) GetPayload() *models.ErrorResponseBody {
	return o.Payload
}

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

	o.Payload = new(models.ErrorResponseBody)

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

	return nil
}
