github.com/cilium/cilium@v1.16.2/api/v1/kvstoremesh/client/cluster/get_cluster_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright Authors of Cilium 4 // SPDX-License-Identifier: Apache-2.0 5 6 package cluster 7 8 // This file was generated by the swagger tool. 9 // Editing this file might prove futile when you re-run the swagger generate command 10 11 import ( 12 "fmt" 13 "io" 14 15 "github.com/go-openapi/runtime" 16 "github.com/go-openapi/strfmt" 17 18 common "github.com/cilium/cilium/api/v1/models" 19 ) 20 21 // GetClusterReader is a Reader for the GetCluster structure. 22 type GetClusterReader struct { 23 formats strfmt.Registry 24 } 25 26 // ReadResponse reads a server response into the received o. 27 func (o *GetClusterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 28 switch response.Code() { 29 case 200: 30 result := NewGetClusterOK() 31 if err := result.readResponse(response, consumer, o.formats); err != nil { 32 return nil, err 33 } 34 return result, nil 35 default: 36 return nil, runtime.NewAPIError("[GET /cluster] GetCluster", response, response.Code()) 37 } 38 } 39 40 // NewGetClusterOK creates a GetClusterOK with default headers values 41 func NewGetClusterOK() *GetClusterOK { 42 return &GetClusterOK{} 43 } 44 45 /* 46 GetClusterOK describes a response with status code 200, with default header values. 47 48 Success 49 */ 50 type GetClusterOK struct { 51 Payload []*common.RemoteCluster 52 } 53 54 // IsSuccess returns true when this get cluster o k response has a 2xx status code 55 func (o *GetClusterOK) IsSuccess() bool { 56 return true 57 } 58 59 // IsRedirect returns true when this get cluster o k response has a 3xx status code 60 func (o *GetClusterOK) IsRedirect() bool { 61 return false 62 } 63 64 // IsClientError returns true when this get cluster o k response has a 4xx status code 65 func (o *GetClusterOK) IsClientError() bool { 66 return false 67 } 68 69 // IsServerError returns true when this get cluster o k response has a 5xx status code 70 func (o *GetClusterOK) IsServerError() bool { 71 return false 72 } 73 74 // IsCode returns true when this get cluster o k response a status code equal to that given 75 func (o *GetClusterOK) IsCode(code int) bool { 76 return code == 200 77 } 78 79 // Code gets the status code for the get cluster o k response 80 func (o *GetClusterOK) Code() int { 81 return 200 82 } 83 84 func (o *GetClusterOK) Error() string { 85 return fmt.Sprintf("[GET /cluster][%d] getClusterOK %+v", 200, o.Payload) 86 } 87 88 func (o *GetClusterOK) String() string { 89 return fmt.Sprintf("[GET /cluster][%d] getClusterOK %+v", 200, o.Payload) 90 } 91 92 func (o *GetClusterOK) GetPayload() []*common.RemoteCluster { 93 return o.Payload 94 } 95 96 func (o *GetClusterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 97 98 // response payload 99 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 100 return err 101 } 102 103 return nil 104 }