github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/firecracker/client/operations/put_guest_vsock_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package operations
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"fmt"
    10  	"io"
    11  
    12  	"github.com/go-openapi/runtime"
    13  
    14  	strfmt "github.com/go-openapi/strfmt"
    15  
    16  	models "github.com/kata-containers/runtime/virtcontainers/pkg/firecracker/client/models"
    17  )
    18  
    19  // PutGuestVsockReader is a Reader for the PutGuestVsock structure.
    20  type PutGuestVsockReader struct {
    21  	formats strfmt.Registry
    22  }
    23  
    24  // ReadResponse reads a server response into the received o.
    25  func (o *PutGuestVsockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    26  	switch response.Code() {
    27  
    28  	case 204:
    29  		result := NewPutGuestVsockNoContent()
    30  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    31  			return nil, err
    32  		}
    33  		return result, nil
    34  
    35  	case 400:
    36  		result := NewPutGuestVsockBadRequest()
    37  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    38  			return nil, err
    39  		}
    40  		return nil, result
    41  
    42  	default:
    43  		result := NewPutGuestVsockDefault(response.Code())
    44  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    45  			return nil, err
    46  		}
    47  		if response.Code()/100 == 2 {
    48  			return result, nil
    49  		}
    50  		return nil, result
    51  	}
    52  }
    53  
    54  // NewPutGuestVsockNoContent creates a PutGuestVsockNoContent with default headers values
    55  func NewPutGuestVsockNoContent() *PutGuestVsockNoContent {
    56  	return &PutGuestVsockNoContent{}
    57  }
    58  
    59  /*PutGuestVsockNoContent handles this case with default header values.
    60  
    61  Vsock created/updated
    62  */
    63  type PutGuestVsockNoContent struct {
    64  }
    65  
    66  func (o *PutGuestVsockNoContent) Error() string {
    67  	return fmt.Sprintf("[PUT /vsock][%d] putGuestVsockNoContent ", 204)
    68  }
    69  
    70  func (o *PutGuestVsockNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    71  
    72  	return nil
    73  }
    74  
    75  // NewPutGuestVsockBadRequest creates a PutGuestVsockBadRequest with default headers values
    76  func NewPutGuestVsockBadRequest() *PutGuestVsockBadRequest {
    77  	return &PutGuestVsockBadRequest{}
    78  }
    79  
    80  /*PutGuestVsockBadRequest handles this case with default header values.
    81  
    82  Vsock cannot be created due to bad input
    83  */
    84  type PutGuestVsockBadRequest struct {
    85  	Payload *models.Error
    86  }
    87  
    88  func (o *PutGuestVsockBadRequest) Error() string {
    89  	return fmt.Sprintf("[PUT /vsock][%d] putGuestVsockBadRequest  %+v", 400, o.Payload)
    90  }
    91  
    92  func (o *PutGuestVsockBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    93  
    94  	o.Payload = new(models.Error)
    95  
    96  	// response payload
    97  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
    98  		return err
    99  	}
   100  
   101  	return nil
   102  }
   103  
   104  // NewPutGuestVsockDefault creates a PutGuestVsockDefault with default headers values
   105  func NewPutGuestVsockDefault(code int) *PutGuestVsockDefault {
   106  	return &PutGuestVsockDefault{
   107  		_statusCode: code,
   108  	}
   109  }
   110  
   111  /*PutGuestVsockDefault handles this case with default header values.
   112  
   113  Internal server error
   114  */
   115  type PutGuestVsockDefault struct {
   116  	_statusCode int
   117  
   118  	Payload *models.Error
   119  }
   120  
   121  // Code gets the status code for the put guest vsock default response
   122  func (o *PutGuestVsockDefault) Code() int {
   123  	return o._statusCode
   124  }
   125  
   126  func (o *PutGuestVsockDefault) Error() string {
   127  	return fmt.Sprintf("[PUT /vsock][%d] putGuestVsock default  %+v", o._statusCode, o.Payload)
   128  }
   129  
   130  func (o *PutGuestVsockDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   131  
   132  	o.Payload = new(models.Error)
   133  
   134  	// response payload
   135  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   136  		return err
   137  	}
   138  
   139  	return nil
   140  }