github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/firecracker/client/operations/get_machine_configuration_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  // GetMachineConfigurationReader is a Reader for the GetMachineConfiguration structure.
    20  type GetMachineConfigurationReader struct {
    21  	formats strfmt.Registry
    22  }
    23  
    24  // ReadResponse reads a server response into the received o.
    25  func (o *GetMachineConfigurationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    26  	switch response.Code() {
    27  
    28  	case 200:
    29  		result := NewGetMachineConfigurationOK()
    30  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    31  			return nil, err
    32  		}
    33  		return result, nil
    34  
    35  	default:
    36  		result := NewGetMachineConfigurationDefault(response.Code())
    37  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    38  			return nil, err
    39  		}
    40  		if response.Code()/100 == 2 {
    41  			return result, nil
    42  		}
    43  		return nil, result
    44  	}
    45  }
    46  
    47  // NewGetMachineConfigurationOK creates a GetMachineConfigurationOK with default headers values
    48  func NewGetMachineConfigurationOK() *GetMachineConfigurationOK {
    49  	return &GetMachineConfigurationOK{}
    50  }
    51  
    52  /*GetMachineConfigurationOK handles this case with default header values.
    53  
    54  OK
    55  */
    56  type GetMachineConfigurationOK struct {
    57  	Payload *models.MachineConfiguration
    58  }
    59  
    60  func (o *GetMachineConfigurationOK) Error() string {
    61  	return fmt.Sprintf("[GET /machine-config][%d] getMachineConfigurationOK  %+v", 200, o.Payload)
    62  }
    63  
    64  func (o *GetMachineConfigurationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    65  
    66  	o.Payload = new(models.MachineConfiguration)
    67  
    68  	// response payload
    69  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
    70  		return err
    71  	}
    72  
    73  	return nil
    74  }
    75  
    76  // NewGetMachineConfigurationDefault creates a GetMachineConfigurationDefault with default headers values
    77  func NewGetMachineConfigurationDefault(code int) *GetMachineConfigurationDefault {
    78  	return &GetMachineConfigurationDefault{
    79  		_statusCode: code,
    80  	}
    81  }
    82  
    83  /*GetMachineConfigurationDefault handles this case with default header values.
    84  
    85  Internal server error
    86  */
    87  type GetMachineConfigurationDefault struct {
    88  	_statusCode int
    89  
    90  	Payload *models.Error
    91  }
    92  
    93  // Code gets the status code for the get machine configuration default response
    94  func (o *GetMachineConfigurationDefault) Code() int {
    95  	return o._statusCode
    96  }
    97  
    98  func (o *GetMachineConfigurationDefault) Error() string {
    99  	return fmt.Sprintf("[GET /machine-config][%d] getMachineConfiguration default  %+v", o._statusCode, o.Payload)
   100  }
   101  
   102  func (o *GetMachineConfigurationDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   103  
   104  	o.Payload = new(models.Error)
   105  
   106  	// response payload
   107  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   108  		return err
   109  	}
   110  
   111  	return nil
   112  }