zrok/rest_client_zrok/agent/ping_responses.go
2025-05-30 13:17:43 -04:00

369 lines
9.3 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package agent
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"encoding/json"
"fmt"
"io"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// PingReader is a Reader for the Ping structure.
type PingReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *PingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewPingOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewPingUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewPingInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 502:
result := NewPingBadGateway()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /agent/ping] ping", response, response.Code())
}
}
// NewPingOK creates a PingOK with default headers values
func NewPingOK() *PingOK {
return &PingOK{}
}
/*
PingOK describes a response with status code 200, with default header values.
ok
*/
type PingOK struct {
Payload *PingOKBody
}
// IsSuccess returns true when this ping o k response has a 2xx status code
func (o *PingOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this ping o k response has a 3xx status code
func (o *PingOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this ping o k response has a 4xx status code
func (o *PingOK) IsClientError() bool {
return false
}
// IsServerError returns true when this ping o k response has a 5xx status code
func (o *PingOK) IsServerError() bool {
return false
}
// IsCode returns true when this ping o k response a status code equal to that given
func (o *PingOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the ping o k response
func (o *PingOK) Code() int {
return 200
}
func (o *PingOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /agent/ping][%d] pingOK %s", 200, payload)
}
func (o *PingOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /agent/ping][%d] pingOK %s", 200, payload)
}
func (o *PingOK) GetPayload() *PingOKBody {
return o.Payload
}
func (o *PingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(PingOKBody)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewPingUnauthorized creates a PingUnauthorized with default headers values
func NewPingUnauthorized() *PingUnauthorized {
return &PingUnauthorized{}
}
/*
PingUnauthorized describes a response with status code 401, with default header values.
unauthorized
*/
type PingUnauthorized struct {
}
// IsSuccess returns true when this ping unauthorized response has a 2xx status code
func (o *PingUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this ping unauthorized response has a 3xx status code
func (o *PingUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this ping unauthorized response has a 4xx status code
func (o *PingUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this ping unauthorized response has a 5xx status code
func (o *PingUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this ping unauthorized response a status code equal to that given
func (o *PingUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the ping unauthorized response
func (o *PingUnauthorized) Code() int {
return 401
}
func (o *PingUnauthorized) Error() string {
return fmt.Sprintf("[POST /agent/ping][%d] pingUnauthorized", 401)
}
func (o *PingUnauthorized) String() string {
return fmt.Sprintf("[POST /agent/ping][%d] pingUnauthorized", 401)
}
func (o *PingUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewPingInternalServerError creates a PingInternalServerError with default headers values
func NewPingInternalServerError() *PingInternalServerError {
return &PingInternalServerError{}
}
/*
PingInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type PingInternalServerError struct {
}
// IsSuccess returns true when this ping internal server error response has a 2xx status code
func (o *PingInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this ping internal server error response has a 3xx status code
func (o *PingInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this ping internal server error response has a 4xx status code
func (o *PingInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this ping internal server error response has a 5xx status code
func (o *PingInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this ping internal server error response a status code equal to that given
func (o *PingInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the ping internal server error response
func (o *PingInternalServerError) Code() int {
return 500
}
func (o *PingInternalServerError) Error() string {
return fmt.Sprintf("[POST /agent/ping][%d] pingInternalServerError", 500)
}
func (o *PingInternalServerError) String() string {
return fmt.Sprintf("[POST /agent/ping][%d] pingInternalServerError", 500)
}
func (o *PingInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewPingBadGateway creates a PingBadGateway with default headers values
func NewPingBadGateway() *PingBadGateway {
return &PingBadGateway{}
}
/*
PingBadGateway describes a response with status code 502, with default header values.
bad gateway; agent not reachable
*/
type PingBadGateway struct {
}
// IsSuccess returns true when this ping bad gateway response has a 2xx status code
func (o *PingBadGateway) IsSuccess() bool {
return false
}
// IsRedirect returns true when this ping bad gateway response has a 3xx status code
func (o *PingBadGateway) IsRedirect() bool {
return false
}
// IsClientError returns true when this ping bad gateway response has a 4xx status code
func (o *PingBadGateway) IsClientError() bool {
return false
}
// IsServerError returns true when this ping bad gateway response has a 5xx status code
func (o *PingBadGateway) IsServerError() bool {
return true
}
// IsCode returns true when this ping bad gateway response a status code equal to that given
func (o *PingBadGateway) IsCode(code int) bool {
return code == 502
}
// Code gets the status code for the ping bad gateway response
func (o *PingBadGateway) Code() int {
return 502
}
func (o *PingBadGateway) Error() string {
return fmt.Sprintf("[POST /agent/ping][%d] pingBadGateway", 502)
}
func (o *PingBadGateway) String() string {
return fmt.Sprintf("[POST /agent/ping][%d] pingBadGateway", 502)
}
func (o *PingBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
/*
PingBody ping body
swagger:model PingBody
*/
type PingBody struct {
// env z Id
EnvZID string `json:"envZId,omitempty"`
}
// Validate validates this ping body
func (o *PingBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this ping body based on context it is used
func (o *PingBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *PingBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *PingBody) UnmarshalBinary(b []byte) error {
var res PingBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
PingOKBody ping o k body
swagger:model PingOKBody
*/
type PingOKBody struct {
// version
Version string `json:"version,omitempty"`
}
// Validate validates this ping o k body
func (o *PingOKBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this ping o k body based on context it is used
func (o *PingOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *PingOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *PingOKBody) UnmarshalBinary(b []byte) error {
var res PingOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}