github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/pkg/firecracker/client/operations/get_mmds_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  // GetMmdsReader is a Reader for the GetMmds structure.
    20  type GetMmdsReader struct {
    21  	formats strfmt.Registry
    22  }
    23  
    24  // ReadResponse reads a server response into the received o.
    25  func (o *GetMmdsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    26  	switch response.Code() {
    27  
    28  	case 200:
    29  		result := NewGetMmdsOK()
    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 := NewGetMmdsBadRequest()
    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 := NewGetMmdsDefault(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  // NewGetMmdsOK creates a GetMmdsOK with default headers values
    55  func NewGetMmdsOK() *GetMmdsOK {
    56  	return &GetMmdsOK{}
    57  }
    58  
    59  /*GetMmdsOK handles this case with default header values.
    60  
    61  The MMDS data store JSON.
    62  */
    63  type GetMmdsOK struct {
    64  	Payload interface{}
    65  }
    66  
    67  func (o *GetMmdsOK) Error() string {
    68  	return fmt.Sprintf("[GET /mmds][%d] getMmdsOK  %+v", 200, o.Payload)
    69  }
    70  
    71  func (o *GetMmdsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    72  
    73  	// response payload
    74  	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
    75  		return err
    76  	}
    77  
    78  	return nil
    79  }
    80  
    81  // NewGetMmdsBadRequest creates a GetMmdsBadRequest with default headers values
    82  func NewGetMmdsBadRequest() *GetMmdsBadRequest {
    83  	return &GetMmdsBadRequest{}
    84  }
    85  
    86  /*GetMmdsBadRequest handles this case with default header values.
    87  
    88  Cannot get the MMDS data store due to bad input.
    89  */
    90  type GetMmdsBadRequest struct {
    91  	Payload *models.Error
    92  }
    93  
    94  func (o *GetMmdsBadRequest) Error() string {
    95  	return fmt.Sprintf("[GET /mmds][%d] getMmdsBadRequest  %+v", 400, o.Payload)
    96  }
    97  
    98  func (o *GetMmdsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    99  
   100  	o.Payload = new(models.Error)
   101  
   102  	// response payload
   103  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   104  		return err
   105  	}
   106  
   107  	return nil
   108  }
   109  
   110  // NewGetMmdsDefault creates a GetMmdsDefault with default headers values
   111  func NewGetMmdsDefault(code int) *GetMmdsDefault {
   112  	return &GetMmdsDefault{
   113  		_statusCode: code,
   114  	}
   115  }
   116  
   117  /*GetMmdsDefault handles this case with default header values.
   118  
   119  Internal server error
   120  */
   121  type GetMmdsDefault struct {
   122  	_statusCode int
   123  
   124  	Payload *models.Error
   125  }
   126  
   127  // Code gets the status code for the get mmds default response
   128  func (o *GetMmdsDefault) Code() int {
   129  	return o._statusCode
   130  }
   131  
   132  func (o *GetMmdsDefault) Error() string {
   133  	return fmt.Sprintf("[GET /mmds][%d] GetMmds default  %+v", o._statusCode, o.Payload)
   134  }
   135  
   136  func (o *GetMmdsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   137  
   138  	o.Payload = new(models.Error)
   139  
   140  	// response payload
   141  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   142  		return err
   143  	}
   144  
   145  	return nil
   146  }