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

package bootstrap

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

import (
	"context"
	"fmt"
	"io"

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

	"github.com/RafayLabs/rcloud-base/api/def/clients/sentry/models"
)

// BootstrapRegisterBootstrapAgentReader is a Reader for the BootstrapRegisterBootstrapAgent structure.
type BootstrapRegisterBootstrapAgentReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *BootstrapRegisterBootstrapAgentReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewBootstrapRegisterBootstrapAgentOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 403:
		result := NewBootstrapRegisterBootstrapAgentForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewBootstrapRegisterBootstrapAgentNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewBootstrapRegisterBootstrapAgentInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewBootstrapRegisterBootstrapAgentDefault(response.Code())
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		if response.Code()/100 == 2 {
			return result, nil
		}
		return nil, result
	}
}

// NewBootstrapRegisterBootstrapAgentOK creates a BootstrapRegisterBootstrapAgentOK with default headers values
func NewBootstrapRegisterBootstrapAgentOK() *BootstrapRegisterBootstrapAgentOK {
	return &BootstrapRegisterBootstrapAgentOK{}
}

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

A successful response.
*/
type BootstrapRegisterBootstrapAgentOK struct {
	Payload *models.RPCRegisterAgentResponse
}

func (o *BootstrapRegisterBootstrapAgentOK) Error() string {
	return fmt.Sprintf("[POST /v2/sentry/bootstrap/{templateToken}/register][%d] bootstrapRegisterBootstrapAgentOK  %+v", 200, o.Payload)
}
func (o *BootstrapRegisterBootstrapAgentOK) GetPayload() *models.RPCRegisterAgentResponse {
	return o.Payload
}

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

	o.Payload = new(models.RPCRegisterAgentResponse)

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

	return nil
}

// NewBootstrapRegisterBootstrapAgentForbidden creates a BootstrapRegisterBootstrapAgentForbidden with default headers values
func NewBootstrapRegisterBootstrapAgentForbidden() *BootstrapRegisterBootstrapAgentForbidden {
	return &BootstrapRegisterBootstrapAgentForbidden{}
}

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

Returned when the user does not have permission to access the resource.
*/
type BootstrapRegisterBootstrapAgentForbidden struct {
	Payload interface{}
}

func (o *BootstrapRegisterBootstrapAgentForbidden) Error() string {
	return fmt.Sprintf("[POST /v2/sentry/bootstrap/{templateToken}/register][%d] bootstrapRegisterBootstrapAgentForbidden  %+v", 403, o.Payload)
}
func (o *BootstrapRegisterBootstrapAgentForbidden) GetPayload() interface{} {
	return o.Payload
}

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

// NewBootstrapRegisterBootstrapAgentNotFound creates a BootstrapRegisterBootstrapAgentNotFound with default headers values
func NewBootstrapRegisterBootstrapAgentNotFound() *BootstrapRegisterBootstrapAgentNotFound {
	return &BootstrapRegisterBootstrapAgentNotFound{}
}

/* BootstrapRegisterBootstrapAgentNotFound describes a response with status code 404, with default header values.

Returned when the resource does not exist.
*/
type BootstrapRegisterBootstrapAgentNotFound struct {
	Payload interface{}
}

func (o *BootstrapRegisterBootstrapAgentNotFound) Error() string {
	return fmt.Sprintf("[POST /v2/sentry/bootstrap/{templateToken}/register][%d] bootstrapRegisterBootstrapAgentNotFound  %+v", 404, o.Payload)
}
func (o *BootstrapRegisterBootstrapAgentNotFound) GetPayload() interface{} {
	return o.Payload
}

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

// NewBootstrapRegisterBootstrapAgentInternalServerError creates a BootstrapRegisterBootstrapAgentInternalServerError with default headers values
func NewBootstrapRegisterBootstrapAgentInternalServerError() *BootstrapRegisterBootstrapAgentInternalServerError {
	return &BootstrapRegisterBootstrapAgentInternalServerError{}
}

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

Returned for internal server error
*/
type BootstrapRegisterBootstrapAgentInternalServerError struct {
	Payload interface{}
}

func (o *BootstrapRegisterBootstrapAgentInternalServerError) Error() string {
	return fmt.Sprintf("[POST /v2/sentry/bootstrap/{templateToken}/register][%d] bootstrapRegisterBootstrapAgentInternalServerError  %+v", 500, o.Payload)
}
func (o *BootstrapRegisterBootstrapAgentInternalServerError) GetPayload() interface{} {
	return o.Payload
}

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

// NewBootstrapRegisterBootstrapAgentDefault creates a BootstrapRegisterBootstrapAgentDefault with default headers values
func NewBootstrapRegisterBootstrapAgentDefault(code int) *BootstrapRegisterBootstrapAgentDefault {
	return &BootstrapRegisterBootstrapAgentDefault{
		_statusCode: code,
	}
}

/* BootstrapRegisterBootstrapAgentDefault describes a response with status code -1, with default header values.

An unexpected error response.
*/
type BootstrapRegisterBootstrapAgentDefault struct {
	_statusCode int

	Payload *models.GooglerpcStatus
}

// Code gets the status code for the bootstrap register bootstrap agent default response
func (o *BootstrapRegisterBootstrapAgentDefault) Code() int {
	return o._statusCode
}

func (o *BootstrapRegisterBootstrapAgentDefault) Error() string {
	return fmt.Sprintf("[POST /v2/sentry/bootstrap/{templateToken}/register][%d] Bootstrap_RegisterBootstrapAgent default  %+v", o._statusCode, o.Payload)
}
func (o *BootstrapRegisterBootstrapAgentDefault) GetPayload() *models.GooglerpcStatus {
	return o.Payload
}

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

	o.Payload = new(models.GooglerpcStatus)

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

	return nil
}

/*BootstrapRegisterBootstrapAgentBody bootstrap register bootstrap agent body
swagger:model BootstrapRegisterBootstrapAgentBody
*/
type BootstrapRegisterBootstrapAgentBody struct {

	// csr
	// Format: byte
	Csr strfmt.Base64 `json:"csr,omitempty"`

	// ip address
	IPAddress string `json:"ipAddress,omitempty"`

	// name
	Name string `json:"name,omitempty"`

	// template name
	TemplateName string `json:"templateName,omitempty"`

	// token
	Token string `json:"token,omitempty"`
}

// Validate validates this bootstrap register bootstrap agent body
func (o *BootstrapRegisterBootstrapAgentBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this bootstrap register bootstrap agent body based on context it is used
func (o *BootstrapRegisterBootstrapAgentBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *BootstrapRegisterBootstrapAgentBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *BootstrapRegisterBootstrapAgentBody) UnmarshalBinary(b []byte) error {
	var res BootstrapRegisterBootstrapAgentBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}
