github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/ping/get_ping_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package ping 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 "github.com/go-openapi/strfmt" 14 ) 15 16 // GetPingReader is a Reader for the GetPing structure. 17 type GetPingReader struct { 18 formats strfmt.Registry 19 } 20 21 // ReadResponse reads a server response into the received o. 22 func (o *GetPingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 23 switch response.Code() { 24 case 200: 25 result := NewGetPingOK() 26 if err := result.readResponse(response, consumer, o.formats); err != nil { 27 return nil, err 28 } 29 return result, nil 30 default: 31 return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) 32 } 33 } 34 35 // NewGetPingOK creates a GetPingOK with default headers values 36 func NewGetPingOK() *GetPingOK { 37 return &GetPingOK{} 38 } 39 40 /* 41 GetPingOK describes a response with status code 200, with default header values. 42 43 The API server is alive 44 */ 45 type GetPingOK struct { 46 Payload string 47 } 48 49 // IsSuccess returns true when this get ping o k response has a 2xx status code 50 func (o *GetPingOK) IsSuccess() bool { 51 return true 52 } 53 54 // IsRedirect returns true when this get ping o k response has a 3xx status code 55 func (o *GetPingOK) IsRedirect() bool { 56 return false 57 } 58 59 // IsClientError returns true when this get ping o k response has a 4xx status code 60 func (o *GetPingOK) IsClientError() bool { 61 return false 62 } 63 64 // IsServerError returns true when this get ping o k response has a 5xx status code 65 func (o *GetPingOK) IsServerError() bool { 66 return false 67 } 68 69 // IsCode returns true when this get ping o k response a status code equal to that given 70 func (o *GetPingOK) IsCode(code int) bool { 71 return code == 200 72 } 73 74 func (o *GetPingOK) Error() string { 75 return fmt.Sprintf("[GET /ping][%d] getPingOK %+v", 200, o.Payload) 76 } 77 78 func (o *GetPingOK) String() string { 79 return fmt.Sprintf("[GET /ping][%d] getPingOK %+v", 200, o.Payload) 80 } 81 82 func (o *GetPingOK) GetPayload() string { 83 return o.Payload 84 } 85 86 func (o *GetPingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 87 88 // response payload 89 if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 90 return err 91 } 92 93 return nil 94 }