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

package migrations

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

// CreateCloudMigrationTokenReader is a Reader for the CreateCloudMigrationToken structure.
type CreateCloudMigrationTokenReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *CreateCloudMigrationTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewCreateCloudMigrationTokenOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewCreateCloudMigrationTokenUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewCreateCloudMigrationTokenForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewCreateCloudMigrationTokenInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /cloudmigration/token] createCloudMigrationToken", response, response.Code())
	}
}

// NewCreateCloudMigrationTokenOK creates a CreateCloudMigrationTokenOK with default headers values
func NewCreateCloudMigrationTokenOK() *CreateCloudMigrationTokenOK {
	return &CreateCloudMigrationTokenOK{}
}

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

(empty)
*/
type CreateCloudMigrationTokenOK struct {
	Payload *models.CreateAccessTokenResponseDTO
}

// IsSuccess returns true when this create cloud migration token Ok response has a 2xx status code
func (o *CreateCloudMigrationTokenOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this create cloud migration token Ok response has a 3xx status code
func (o *CreateCloudMigrationTokenOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cloud migration token Ok response has a 4xx status code
func (o *CreateCloudMigrationTokenOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this create cloud migration token Ok response has a 5xx status code
func (o *CreateCloudMigrationTokenOK) IsServerError() bool {
	return false
}

// IsCode returns true when this create cloud migration token Ok response a status code equal to that given
func (o *CreateCloudMigrationTokenOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the create cloud migration token Ok response
func (o *CreateCloudMigrationTokenOK) Code() int {
	return 200
}

func (o *CreateCloudMigrationTokenOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /cloudmigration/token][%d] createCloudMigrationTokenOk %s", 200, payload)
}

func (o *CreateCloudMigrationTokenOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /cloudmigration/token][%d] createCloudMigrationTokenOk %s", 200, payload)
}

func (o *CreateCloudMigrationTokenOK) GetPayload() *models.CreateAccessTokenResponseDTO {
	return o.Payload
}

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

	o.Payload = new(models.CreateAccessTokenResponseDTO)

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

	return nil
}

// NewCreateCloudMigrationTokenUnauthorized creates a CreateCloudMigrationTokenUnauthorized with default headers values
func NewCreateCloudMigrationTokenUnauthorized() *CreateCloudMigrationTokenUnauthorized {
	return &CreateCloudMigrationTokenUnauthorized{}
}

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

UnauthorizedError is returned when the request is not authenticated.
*/
type CreateCloudMigrationTokenUnauthorized struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this create cloud migration token unauthorized response has a 2xx status code
func (o *CreateCloudMigrationTokenUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create cloud migration token unauthorized response has a 3xx status code
func (o *CreateCloudMigrationTokenUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cloud migration token unauthorized response has a 4xx status code
func (o *CreateCloudMigrationTokenUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this create cloud migration token unauthorized response has a 5xx status code
func (o *CreateCloudMigrationTokenUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this create cloud migration token unauthorized response a status code equal to that given
func (o *CreateCloudMigrationTokenUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the create cloud migration token unauthorized response
func (o *CreateCloudMigrationTokenUnauthorized) Code() int {
	return 401
}

func (o *CreateCloudMigrationTokenUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /cloudmigration/token][%d] createCloudMigrationTokenUnauthorized %s", 401, payload)
}

func (o *CreateCloudMigrationTokenUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /cloudmigration/token][%d] createCloudMigrationTokenUnauthorized %s", 401, payload)
}

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

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

// NewCreateCloudMigrationTokenForbidden creates a CreateCloudMigrationTokenForbidden with default headers values
func NewCreateCloudMigrationTokenForbidden() *CreateCloudMigrationTokenForbidden {
	return &CreateCloudMigrationTokenForbidden{}
}

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

ForbiddenError is returned if the user/token has insufficient permissions to access the requested resource.
*/
type CreateCloudMigrationTokenForbidden struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this create cloud migration token forbidden response has a 2xx status code
func (o *CreateCloudMigrationTokenForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create cloud migration token forbidden response has a 3xx status code
func (o *CreateCloudMigrationTokenForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cloud migration token forbidden response has a 4xx status code
func (o *CreateCloudMigrationTokenForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this create cloud migration token forbidden response has a 5xx status code
func (o *CreateCloudMigrationTokenForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this create cloud migration token forbidden response a status code equal to that given
func (o *CreateCloudMigrationTokenForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the create cloud migration token forbidden response
func (o *CreateCloudMigrationTokenForbidden) Code() int {
	return 403
}

func (o *CreateCloudMigrationTokenForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /cloudmigration/token][%d] createCloudMigrationTokenForbidden %s", 403, payload)
}

func (o *CreateCloudMigrationTokenForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /cloudmigration/token][%d] createCloudMigrationTokenForbidden %s", 403, payload)
}

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

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

// NewCreateCloudMigrationTokenInternalServerError creates a CreateCloudMigrationTokenInternalServerError with default headers values
func NewCreateCloudMigrationTokenInternalServerError() *CreateCloudMigrationTokenInternalServerError {
	return &CreateCloudMigrationTokenInternalServerError{}
}

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

InternalServerError is a general error indicating something went wrong internally.
*/
type CreateCloudMigrationTokenInternalServerError struct {
	Payload *models.ErrorResponseBody
}

// IsSuccess returns true when this create cloud migration token internal server error response has a 2xx status code
func (o *CreateCloudMigrationTokenInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create cloud migration token internal server error response has a 3xx status code
func (o *CreateCloudMigrationTokenInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cloud migration token internal server error response has a 4xx status code
func (o *CreateCloudMigrationTokenInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this create cloud migration token internal server error response has a 5xx status code
func (o *CreateCloudMigrationTokenInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this create cloud migration token internal server error response a status code equal to that given
func (o *CreateCloudMigrationTokenInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the create cloud migration token internal server error response
func (o *CreateCloudMigrationTokenInternalServerError) Code() int {
	return 500
}

func (o *CreateCloudMigrationTokenInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /cloudmigration/token][%d] createCloudMigrationTokenInternalServerError %s", 500, payload)
}

func (o *CreateCloudMigrationTokenInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /cloudmigration/token][%d] createCloudMigrationTokenInternalServerError %s", 500, payload)
}

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

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