clean up; /agent/ping (#967)

This commit is contained in:
Michael Quigley 2025-05-30 13:17:43 -04:00
parent a7899b3a98
commit f4057655be
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
46 changed files with 1350 additions and 1480 deletions

37
controller/agentPing.go Normal file
View File

@ -0,0 +1,37 @@
package controller
import (
"context"
"github.com/go-openapi/runtime/middleware"
"github.com/openziti/zrok/agent/agentGrpc"
"github.com/openziti/zrok/controller/agentController"
"github.com/openziti/zrok/controller/config"
"github.com/openziti/zrok/rest_model_zrok"
"github.com/openziti/zrok/rest_server_zrok/operations/agent"
"github.com/sirupsen/logrus"
)
type agentPingHandler struct {
cfg *config.Config
}
func newAgentPingHandler(cfg *config.Config) *agentPingHandler {
return &agentPingHandler{cfg: cfg}
}
func (h *agentPingHandler) Handle(params agent.PingParams, principal *rest_model_zrok.Principal) middleware.Responder {
acli, aconn, err := agentController.NewAgentClient(params.Body.EnvZID, h.cfg.AgentController)
if err != nil {
logrus.Errorf("error creating agent client for '%v' (%v): %v", params.Body.EnvZID, principal.Email, err)
return agent.NewPingInternalServerError()
}
defer aconn.Close()
resp, err := acli.Version(context.Background(), &agentGrpc.VersionRequest{})
if err != nil {
logrus.Errorf("error retrieving agent version for '%v' (%v): %v", params.Body.EnvZID, principal.Email, err)
return agent.NewPingBadGateway()
}
return agent.NewPingOK().WithPayload(&agent.PingOKBody{Version: resp.V})
}

View File

@ -1,40 +0,0 @@
package controller
import (
"context"
"github.com/go-openapi/runtime/middleware"
"github.com/openziti/zrok/agent/agentGrpc"
"github.com/openziti/zrok/controller/agentController"
"github.com/openziti/zrok/controller/config"
"github.com/openziti/zrok/rest_model_zrok"
"github.com/openziti/zrok/rest_server_zrok/operations/agent"
"github.com/sirupsen/logrus"
)
type agentStatusHandler struct {
cfg *config.Config
}
func newAgentStatusHandler(cfg *config.Config) *agentStatusHandler {
return &agentStatusHandler{cfg: cfg}
}
func (h *agentStatusHandler) Handle(params agent.AgentStatusParams, principal *rest_model_zrok.Principal) middleware.Responder {
if h.cfg.AgentController != nil {
acli, aconn, err := agentController.NewAgentClient(params.Body.EnvZID, h.cfg.AgentController)
if err != nil {
logrus.Errorf("error creating agent client for '%v' (%v): %v", params.Body.EnvZID, principal.Email, err)
return agent.NewAgentStatusInternalServerError()
}
defer aconn.Close()
resp, err := acli.Version(context.Background(), &agentGrpc.VersionRequest{})
if err != nil {
logrus.Errorf("error retrieving agent version for '%v' (%v): %v", params.Body.EnvZID, principal.Email, err)
return agent.NewAgentStatusInternalServerError()
}
return agent.NewAgentStatusOK().WithPayload(&agent.AgentStatusOKBody{Version: resp.V})
}
return agent.NewAgentStatusUnauthorized()
}

View File

@ -65,7 +65,9 @@ func Run(inCfg *config.Config) error {
api.AdminListOrganizationsHandler = newListOrganizationsHandler()
api.AdminRemoveOrganizationMemberHandler = newRemoveOrganizationMemberHandler()
api.AdminUpdateFrontendHandler = newUpdateFrontendHandler()
api.AgentAgentStatusHandler = newAgentStatusHandler(cfg)
if cfg.AgentController != nil {
api.AgentPingHandler = newAgentPingHandler(cfg)
}
api.EnvironmentEnableHandler = newEnableHandler()
api.EnvironmentDisableHandler = newDisableHandler()
api.MetadataConfigurationHandler = newConfigurationHandler(cfg)

View File

@ -100,28 +100,28 @@ func WithAcceptApplicationZrokV1JSON(r *runtime.ClientOperation) {
// ClientService is the interface for Client methods
type ClientService interface {
AgentStatus(params *AgentStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AgentStatusOK, error)
Ping(params *PingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PingOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
AgentStatus agent status API
Ping ping API
*/
func (a *Client) AgentStatus(params *AgentStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AgentStatusOK, error) {
func (a *Client) Ping(params *PingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PingOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewAgentStatusParams()
params = NewPingParams()
}
op := &runtime.ClientOperation{
ID: "agentStatus",
ID: "ping",
Method: "POST",
PathPattern: "/agent/status",
PathPattern: "/agent/ping",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &AgentStatusReader{formats: a.formats},
Reader: &PingReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
@ -134,13 +134,13 @@ func (a *Client) AgentStatus(params *AgentStatusParams, authInfo runtime.ClientA
if err != nil {
return nil, err
}
success, ok := result.(*AgentStatusOK)
success, ok := result.(*PingOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for agentStatus: API contract not enforced by server. Client expected to get an error, but got: %T", result)
msg := fmt.Sprintf("unexpected success response for ping: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}

View File

@ -1,146 +0,0 @@
// 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"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewAgentStatusParams creates a new AgentStatusParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewAgentStatusParams() *AgentStatusParams {
return &AgentStatusParams{
timeout: cr.DefaultTimeout,
}
}
// NewAgentStatusParamsWithTimeout creates a new AgentStatusParams object
// with the ability to set a timeout on a request.
func NewAgentStatusParamsWithTimeout(timeout time.Duration) *AgentStatusParams {
return &AgentStatusParams{
timeout: timeout,
}
}
// NewAgentStatusParamsWithContext creates a new AgentStatusParams object
// with the ability to set a context for a request.
func NewAgentStatusParamsWithContext(ctx context.Context) *AgentStatusParams {
return &AgentStatusParams{
Context: ctx,
}
}
// NewAgentStatusParamsWithHTTPClient creates a new AgentStatusParams object
// with the ability to set a custom HTTPClient for a request.
func NewAgentStatusParamsWithHTTPClient(client *http.Client) *AgentStatusParams {
return &AgentStatusParams{
HTTPClient: client,
}
}
/*
AgentStatusParams contains all the parameters to send to the API endpoint
for the agent status operation.
Typically these are written to a http.Request.
*/
type AgentStatusParams struct {
// Body.
Body AgentStatusBody
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the agent status params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AgentStatusParams) WithDefaults() *AgentStatusParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the agent status params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AgentStatusParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the agent status params
func (o *AgentStatusParams) WithTimeout(timeout time.Duration) *AgentStatusParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the agent status params
func (o *AgentStatusParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the agent status params
func (o *AgentStatusParams) WithContext(ctx context.Context) *AgentStatusParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the agent status params
func (o *AgentStatusParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the agent status params
func (o *AgentStatusParams) WithHTTPClient(client *http.Client) *AgentStatusParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the agent status params
func (o *AgentStatusParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the agent status params
func (o *AgentStatusParams) WithBody(body AgentStatusBody) *AgentStatusParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the agent status params
func (o *AgentStatusParams) SetBody(body AgentStatusBody) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *AgentStatusParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -1,382 +0,0 @@
// 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"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/openziti/zrok/rest_model_zrok"
)
// AgentStatusReader is a Reader for the AgentStatus structure.
type AgentStatusReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *AgentStatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewAgentStatusOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 401:
result := NewAgentStatusUnauthorized()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
case 500:
result := NewAgentStatusInternalServerError()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return nil, result
default:
return nil, runtime.NewAPIError("[POST /agent/status] agentStatus", response, response.Code())
}
}
// NewAgentStatusOK creates a AgentStatusOK with default headers values
func NewAgentStatusOK() *AgentStatusOK {
return &AgentStatusOK{}
}
/*
AgentStatusOK describes a response with status code 200, with default header values.
ok
*/
type AgentStatusOK struct {
Payload *AgentStatusOKBody
}
// IsSuccess returns true when this agent status o k response has a 2xx status code
func (o *AgentStatusOK) IsSuccess() bool {
return true
}
// IsRedirect returns true when this agent status o k response has a 3xx status code
func (o *AgentStatusOK) IsRedirect() bool {
return false
}
// IsClientError returns true when this agent status o k response has a 4xx status code
func (o *AgentStatusOK) IsClientError() bool {
return false
}
// IsServerError returns true when this agent status o k response has a 5xx status code
func (o *AgentStatusOK) IsServerError() bool {
return false
}
// IsCode returns true when this agent status o k response a status code equal to that given
func (o *AgentStatusOK) IsCode(code int) bool {
return code == 200
}
// Code gets the status code for the agent status o k response
func (o *AgentStatusOK) Code() int {
return 200
}
func (o *AgentStatusOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /agent/status][%d] agentStatusOK %s", 200, payload)
}
func (o *AgentStatusOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[POST /agent/status][%d] agentStatusOK %s", 200, payload)
}
func (o *AgentStatusOK) GetPayload() *AgentStatusOKBody {
return o.Payload
}
func (o *AgentStatusOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(AgentStatusOKBody)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewAgentStatusUnauthorized creates a AgentStatusUnauthorized with default headers values
func NewAgentStatusUnauthorized() *AgentStatusUnauthorized {
return &AgentStatusUnauthorized{}
}
/*
AgentStatusUnauthorized describes a response with status code 401, with default header values.
unauthorized
*/
type AgentStatusUnauthorized struct {
}
// IsSuccess returns true when this agent status unauthorized response has a 2xx status code
func (o *AgentStatusUnauthorized) IsSuccess() bool {
return false
}
// IsRedirect returns true when this agent status unauthorized response has a 3xx status code
func (o *AgentStatusUnauthorized) IsRedirect() bool {
return false
}
// IsClientError returns true when this agent status unauthorized response has a 4xx status code
func (o *AgentStatusUnauthorized) IsClientError() bool {
return true
}
// IsServerError returns true when this agent status unauthorized response has a 5xx status code
func (o *AgentStatusUnauthorized) IsServerError() bool {
return false
}
// IsCode returns true when this agent status unauthorized response a status code equal to that given
func (o *AgentStatusUnauthorized) IsCode(code int) bool {
return code == 401
}
// Code gets the status code for the agent status unauthorized response
func (o *AgentStatusUnauthorized) Code() int {
return 401
}
func (o *AgentStatusUnauthorized) Error() string {
return fmt.Sprintf("[POST /agent/status][%d] agentStatusUnauthorized", 401)
}
func (o *AgentStatusUnauthorized) String() string {
return fmt.Sprintf("[POST /agent/status][%d] agentStatusUnauthorized", 401)
}
func (o *AgentStatusUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
// NewAgentStatusInternalServerError creates a AgentStatusInternalServerError with default headers values
func NewAgentStatusInternalServerError() *AgentStatusInternalServerError {
return &AgentStatusInternalServerError{}
}
/*
AgentStatusInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type AgentStatusInternalServerError struct {
}
// IsSuccess returns true when this agent status internal server error response has a 2xx status code
func (o *AgentStatusInternalServerError) IsSuccess() bool {
return false
}
// IsRedirect returns true when this agent status internal server error response has a 3xx status code
func (o *AgentStatusInternalServerError) IsRedirect() bool {
return false
}
// IsClientError returns true when this agent status internal server error response has a 4xx status code
func (o *AgentStatusInternalServerError) IsClientError() bool {
return false
}
// IsServerError returns true when this agent status internal server error response has a 5xx status code
func (o *AgentStatusInternalServerError) IsServerError() bool {
return true
}
// IsCode returns true when this agent status internal server error response a status code equal to that given
func (o *AgentStatusInternalServerError) IsCode(code int) bool {
return code == 500
}
// Code gets the status code for the agent status internal server error response
func (o *AgentStatusInternalServerError) Code() int {
return 500
}
func (o *AgentStatusInternalServerError) Error() string {
return fmt.Sprintf("[POST /agent/status][%d] agentStatusInternalServerError", 500)
}
func (o *AgentStatusInternalServerError) String() string {
return fmt.Sprintf("[POST /agent/status][%d] agentStatusInternalServerError", 500)
}
func (o *AgentStatusInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
return nil
}
/*
AgentStatusBody agent status body
swagger:model AgentStatusBody
*/
type AgentStatusBody struct {
// env z Id
EnvZID string `json:"envZId,omitempty"`
}
// Validate validates this agent status body
func (o *AgentStatusBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this agent status body based on context it is used
func (o *AgentStatusBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *AgentStatusBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *AgentStatusBody) UnmarshalBinary(b []byte) error {
var res AgentStatusBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
/*
AgentStatusOKBody agent status o k body
swagger:model AgentStatusOKBody
*/
type AgentStatusOKBody struct {
// shares
Shares []*rest_model_zrok.Share `json:"shares"`
// version
Version string `json:"version,omitempty"`
}
// Validate validates this agent status o k body
func (o *AgentStatusOKBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateShares(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *AgentStatusOKBody) validateShares(formats strfmt.Registry) error {
if swag.IsZero(o.Shares) { // not required
return nil
}
for i := 0; i < len(o.Shares); i++ {
if swag.IsZero(o.Shares[i]) { // not required
continue
}
if o.Shares[i] != nil {
if err := o.Shares[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("agentStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("agentStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this agent status o k body based on the context it is used
func (o *AgentStatusOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateShares(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *AgentStatusOKBody) contextValidateShares(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(o.Shares); i++ {
if o.Shares[i] != nil {
if swag.IsZero(o.Shares[i]) { // not required
return nil
}
if err := o.Shares[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("agentStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("agentStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (o *AgentStatusOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *AgentStatusOKBody) UnmarshalBinary(b []byte) error {
var res AgentStatusOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -0,0 +1,146 @@
// 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"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewPingParams creates a new PingParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPingParams() *PingParams {
return &PingParams{
timeout: cr.DefaultTimeout,
}
}
// NewPingParamsWithTimeout creates a new PingParams object
// with the ability to set a timeout on a request.
func NewPingParamsWithTimeout(timeout time.Duration) *PingParams {
return &PingParams{
timeout: timeout,
}
}
// NewPingParamsWithContext creates a new PingParams object
// with the ability to set a context for a request.
func NewPingParamsWithContext(ctx context.Context) *PingParams {
return &PingParams{
Context: ctx,
}
}
// NewPingParamsWithHTTPClient creates a new PingParams object
// with the ability to set a custom HTTPClient for a request.
func NewPingParamsWithHTTPClient(client *http.Client) *PingParams {
return &PingParams{
HTTPClient: client,
}
}
/*
PingParams contains all the parameters to send to the API endpoint
for the ping operation.
Typically these are written to a http.Request.
*/
type PingParams struct {
// Body.
Body PingBody
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the ping params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PingParams) WithDefaults() *PingParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the ping params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PingParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the ping params
func (o *PingParams) WithTimeout(timeout time.Duration) *PingParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the ping params
func (o *PingParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the ping params
func (o *PingParams) WithContext(ctx context.Context) *PingParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the ping params
func (o *PingParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the ping params
func (o *PingParams) WithHTTPClient(client *http.Client) *PingParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the ping params
func (o *PingParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the ping params
func (o *PingParams) WithBody(body PingBody) *PingParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the ping params
func (o *PingParams) SetBody(body PingBody) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *PingParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,368 @@
// 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
}

View File

@ -185,7 +185,7 @@ func init() {
}
}
},
"/agent/status": {
"/agent/ping": {
"post": {
"security": [
{
@ -195,7 +195,7 @@ func init() {
"tags": [
"agent"
],
"operationId": "agentStatus",
"operationId": "ping",
"parameters": [
{
"name": "body",
@ -214,12 +214,6 @@ func init() {
"description": "ok",
"schema": {
"properties": {
"shares": {
"type": "array",
"items": {
"$ref": "#/definitions/share"
}
},
"version": {
"type": "string"
}
@ -231,6 +225,9 @@ func init() {
},
"500": {
"description": "internal server error"
},
"502": {
"description": "bad gateway; agent not reachable"
}
}
}
@ -2546,7 +2543,7 @@ func init() {
}
}
},
"/agent/status": {
"/agent/ping": {
"post": {
"security": [
{
@ -2556,7 +2553,7 @@ func init() {
"tags": [
"agent"
],
"operationId": "agentStatus",
"operationId": "ping",
"parameters": [
{
"name": "body",
@ -2575,12 +2572,6 @@ func init() {
"description": "ok",
"schema": {
"properties": {
"shares": {
"type": "array",
"items": {
"$ref": "#/definitions/share"
}
},
"version": {
"type": "string"
}
@ -2592,6 +2583,9 @@ func init() {
},
"500": {
"description": "internal server error"
},
"502": {
"description": "bad gateway; agent not reachable"
}
}
}

View File

@ -1,222 +0,0 @@
// 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 generate command
import (
"context"
"net/http"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/openziti/zrok/rest_model_zrok"
)
// AgentStatusHandlerFunc turns a function with the right signature into a agent status handler
type AgentStatusHandlerFunc func(AgentStatusParams, *rest_model_zrok.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn AgentStatusHandlerFunc) Handle(params AgentStatusParams, principal *rest_model_zrok.Principal) middleware.Responder {
return fn(params, principal)
}
// AgentStatusHandler interface for that can handle valid agent status params
type AgentStatusHandler interface {
Handle(AgentStatusParams, *rest_model_zrok.Principal) middleware.Responder
}
// NewAgentStatus creates a new http.Handler for the agent status operation
func NewAgentStatus(ctx *middleware.Context, handler AgentStatusHandler) *AgentStatus {
return &AgentStatus{Context: ctx, Handler: handler}
}
/*
AgentStatus swagger:route POST /agent/status agent agentStatus
AgentStatus agent status API
*/
type AgentStatus struct {
Context *middleware.Context
Handler AgentStatusHandler
}
func (o *AgentStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewAgentStatusParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *rest_model_zrok.Principal
if uprinc != nil {
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}
// AgentStatusBody agent status body
//
// swagger:model AgentStatusBody
type AgentStatusBody struct {
// env z Id
EnvZID string `json:"envZId,omitempty"`
}
// Validate validates this agent status body
func (o *AgentStatusBody) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this agent status body based on context it is used
func (o *AgentStatusBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (o *AgentStatusBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *AgentStatusBody) UnmarshalBinary(b []byte) error {
var res AgentStatusBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}
// AgentStatusOKBody agent status o k body
//
// swagger:model AgentStatusOKBody
type AgentStatusOKBody struct {
// shares
Shares []*rest_model_zrok.Share `json:"shares"`
// version
Version string `json:"version,omitempty"`
}
// Validate validates this agent status o k body
func (o *AgentStatusOKBody) Validate(formats strfmt.Registry) error {
var res []error
if err := o.validateShares(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *AgentStatusOKBody) validateShares(formats strfmt.Registry) error {
if swag.IsZero(o.Shares) { // not required
return nil
}
for i := 0; i < len(o.Shares); i++ {
if swag.IsZero(o.Shares[i]) { // not required
continue
}
if o.Shares[i] != nil {
if err := o.Shares[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("agentStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("agentStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this agent status o k body based on the context it is used
func (o *AgentStatusOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := o.contextValidateShares(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *AgentStatusOKBody) contextValidateShares(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(o.Shares); i++ {
if o.Shares[i] != nil {
if swag.IsZero(o.Shares[i]) { // not required
return nil
}
if err := o.Shares[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("agentStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("agentStatusOK" + "." + "shares" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (o *AgentStatusOKBody) MarshalBinary() ([]byte, error) {
if o == nil {
return nil, nil
}
return swag.WriteJSON(o)
}
// UnmarshalBinary interface implementation
func (o *AgentStatusOKBody) UnmarshalBinary(b []byte) error {
var res AgentStatusOKBody
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*o = res
return nil
}

View File

@ -1,107 +0,0 @@
// 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 (
"net/http"
"github.com/go-openapi/runtime"
)
// AgentStatusOKCode is the HTTP code returned for type AgentStatusOK
const AgentStatusOKCode int = 200
/*
AgentStatusOK ok
swagger:response agentStatusOK
*/
type AgentStatusOK struct {
/*
In: Body
*/
Payload *AgentStatusOKBody `json:"body,omitempty"`
}
// NewAgentStatusOK creates AgentStatusOK with default headers values
func NewAgentStatusOK() *AgentStatusOK {
return &AgentStatusOK{}
}
// WithPayload adds the payload to the agent status o k response
func (o *AgentStatusOK) WithPayload(payload *AgentStatusOKBody) *AgentStatusOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the agent status o k response
func (o *AgentStatusOK) SetPayload(payload *AgentStatusOKBody) {
o.Payload = payload
}
// WriteResponse to the client
func (o *AgentStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// AgentStatusUnauthorizedCode is the HTTP code returned for type AgentStatusUnauthorized
const AgentStatusUnauthorizedCode int = 401
/*
AgentStatusUnauthorized unauthorized
swagger:response agentStatusUnauthorized
*/
type AgentStatusUnauthorized struct {
}
// NewAgentStatusUnauthorized creates AgentStatusUnauthorized with default headers values
func NewAgentStatusUnauthorized() *AgentStatusUnauthorized {
return &AgentStatusUnauthorized{}
}
// WriteResponse to the client
func (o *AgentStatusUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(401)
}
// AgentStatusInternalServerErrorCode is the HTTP code returned for type AgentStatusInternalServerError
const AgentStatusInternalServerErrorCode int = 500
/*
AgentStatusInternalServerError internal server error
swagger:response agentStatusInternalServerError
*/
type AgentStatusInternalServerError struct {
}
// NewAgentStatusInternalServerError creates AgentStatusInternalServerError with default headers values
func NewAgentStatusInternalServerError() *AgentStatusInternalServerError {
return &AgentStatusInternalServerError{}
}
// WriteResponse to the client
func (o *AgentStatusInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(500)
}

View File

@ -0,0 +1,148 @@
// 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 generate command
import (
"context"
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/openziti/zrok/rest_model_zrok"
)
// PingHandlerFunc turns a function with the right signature into a ping handler
type PingHandlerFunc func(PingParams, *rest_model_zrok.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn PingHandlerFunc) Handle(params PingParams, principal *rest_model_zrok.Principal) middleware.Responder {
return fn(params, principal)
}
// PingHandler interface for that can handle valid ping params
type PingHandler interface {
Handle(PingParams, *rest_model_zrok.Principal) middleware.Responder
}
// NewPing creates a new http.Handler for the ping operation
func NewPing(ctx *middleware.Context, handler PingHandler) *Ping {
return &Ping{Context: ctx, Handler: handler}
}
/*
Ping swagger:route POST /agent/ping agent ping
Ping ping API
*/
type Ping struct {
Context *middleware.Context
Handler PingHandler
}
func (o *Ping) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewPingParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *rest_model_zrok.Principal
if uprinc != nil {
principal = uprinc.(*rest_model_zrok.Principal) // this is really a rest_model_zrok.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}
// 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
}

View File

@ -14,19 +14,19 @@ import (
"github.com/go-openapi/validate"
)
// NewAgentStatusParams creates a new AgentStatusParams object
// NewPingParams creates a new PingParams object
//
// There are no default values defined in the spec.
func NewAgentStatusParams() AgentStatusParams {
func NewPingParams() PingParams {
return AgentStatusParams{}
return PingParams{}
}
// AgentStatusParams contains all the bound params for the agent status operation
// PingParams contains all the bound params for the ping operation
// typically these are obtained from a http.Request
//
// swagger:parameters agentStatus
type AgentStatusParams struct {
// swagger:parameters ping
type PingParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
@ -34,21 +34,21 @@ type AgentStatusParams struct {
/*
In: body
*/
Body AgentStatusBody
Body PingBody
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
// for simple values it will use straight method calls.
//
// To ensure default values, the struct must have been initialized with NewAgentStatusParams() beforehand.
func (o *AgentStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
// To ensure default values, the struct must have been initialized with NewPingParams() beforehand.
func (o *PingParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body AgentStatusBody
var body PingBody
if err := route.Consumer.Consume(r.Body, &body); err != nil {
res = append(res, errors.NewParseError("body", "body", "", err))
} else {

View File

@ -0,0 +1,132 @@
// 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 (
"net/http"
"github.com/go-openapi/runtime"
)
// PingOKCode is the HTTP code returned for type PingOK
const PingOKCode int = 200
/*
PingOK ok
swagger:response pingOK
*/
type PingOK struct {
/*
In: Body
*/
Payload *PingOKBody `json:"body,omitempty"`
}
// NewPingOK creates PingOK with default headers values
func NewPingOK() *PingOK {
return &PingOK{}
}
// WithPayload adds the payload to the ping o k response
func (o *PingOK) WithPayload(payload *PingOKBody) *PingOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the ping o k response
func (o *PingOK) SetPayload(payload *PingOKBody) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PingOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
// PingUnauthorizedCode is the HTTP code returned for type PingUnauthorized
const PingUnauthorizedCode int = 401
/*
PingUnauthorized unauthorized
swagger:response pingUnauthorized
*/
type PingUnauthorized struct {
}
// NewPingUnauthorized creates PingUnauthorized with default headers values
func NewPingUnauthorized() *PingUnauthorized {
return &PingUnauthorized{}
}
// WriteResponse to the client
func (o *PingUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(401)
}
// PingInternalServerErrorCode is the HTTP code returned for type PingInternalServerError
const PingInternalServerErrorCode int = 500
/*
PingInternalServerError internal server error
swagger:response pingInternalServerError
*/
type PingInternalServerError struct {
}
// NewPingInternalServerError creates PingInternalServerError with default headers values
func NewPingInternalServerError() *PingInternalServerError {
return &PingInternalServerError{}
}
// WriteResponse to the client
func (o *PingInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(500)
}
// PingBadGatewayCode is the HTTP code returned for type PingBadGateway
const PingBadGatewayCode int = 502
/*
PingBadGateway bad gateway; agent not reachable
swagger:response pingBadGateway
*/
type PingBadGateway struct {
}
// NewPingBadGateway creates PingBadGateway with default headers values
func NewPingBadGateway() *PingBadGateway {
return &PingBadGateway{}
}
// WriteResponse to the client
func (o *PingBadGateway) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(502)
}

View File

@ -11,15 +11,15 @@ import (
golangswaggerpaths "path"
)
// AgentStatusURL generates an URL for the agent status operation
type AgentStatusURL struct {
// PingURL generates an URL for the ping operation
type PingURL struct {
_basePath string
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *AgentStatusURL) WithBasePath(bp string) *AgentStatusURL {
func (o *PingURL) WithBasePath(bp string) *PingURL {
o.SetBasePath(bp)
return o
}
@ -27,15 +27,15 @@ func (o *AgentStatusURL) WithBasePath(bp string) *AgentStatusURL {
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *AgentStatusURL) SetBasePath(bp string) {
func (o *PingURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *AgentStatusURL) Build() (*url.URL, error) {
func (o *PingURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/agent/status"
var _path = "/agent/ping"
_basePath := o._basePath
if _basePath == "" {
@ -47,7 +47,7 @@ func (o *AgentStatusURL) Build() (*url.URL, error) {
}
// Must is a helper function to panic when the url builder returns an error
func (o *AgentStatusURL) Must(u *url.URL, err error) *url.URL {
func (o *PingURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
@ -58,17 +58,17 @@ func (o *AgentStatusURL) Must(u *url.URL, err error) *url.URL {
}
// String returns the string representation of the path with query string
func (o *AgentStatusURL) String() string {
func (o *PingURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *AgentStatusURL) BuildFull(scheme, host string) (*url.URL, error) {
func (o *PingURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on AgentStatusURL")
return nil, errors.New("scheme is required for a full url on PingURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on AgentStatusURL")
return nil, errors.New("host is required for a full url on PingURL")
}
base, err := o.Build()
@ -82,6 +82,6 @@ func (o *AgentStatusURL) BuildFull(scheme, host string) (*url.URL, error) {
}
// StringFull returns the string representation of a complete url
func (o *AgentStatusURL) StringFull(scheme, host string) string {
func (o *PingURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@ -56,9 +56,6 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
AdminAddOrganizationMemberHandler: admin.AddOrganizationMemberHandlerFunc(func(params admin.AddOrganizationMemberParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation admin.AddOrganizationMember has not yet been implemented")
}),
AgentAgentStatusHandler: agent.AgentStatusHandlerFunc(func(params agent.AgentStatusParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation agent.AgentStatus has not yet been implemented")
}),
AccountChangePasswordHandler: account.ChangePasswordHandlerFunc(func(params account.ChangePasswordParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation account.ChangePassword has not yet been implemented")
}),
@ -149,6 +146,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
MetadataOverviewHandler: metadata.OverviewHandlerFunc(func(params metadata.OverviewParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation metadata.Overview has not yet been implemented")
}),
AgentPingHandler: agent.PingHandlerFunc(func(params agent.PingParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation agent.Ping has not yet been implemented")
}),
AccountRegenerateAccountTokenHandler: account.RegenerateAccountTokenHandlerFunc(func(params account.RegenerateAccountTokenParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation account.RegenerateAccountToken has not yet been implemented")
}),
@ -245,8 +245,6 @@ type ZrokAPI struct {
ShareAccessHandler share.AccessHandler
// AdminAddOrganizationMemberHandler sets the operation handler for the add organization member operation
AdminAddOrganizationMemberHandler admin.AddOrganizationMemberHandler
// AgentAgentStatusHandler sets the operation handler for the agent status operation
AgentAgentStatusHandler agent.AgentStatusHandler
// AccountChangePasswordHandler sets the operation handler for the change password operation
AccountChangePasswordHandler account.ChangePasswordHandler
// MetadataClientVersionCheckHandler sets the operation handler for the client version check operation
@ -307,6 +305,8 @@ type ZrokAPI struct {
MetadataOrgAccountOverviewHandler metadata.OrgAccountOverviewHandler
// MetadataOverviewHandler sets the operation handler for the overview operation
MetadataOverviewHandler metadata.OverviewHandler
// AgentPingHandler sets the operation handler for the ping operation
AgentPingHandler agent.PingHandler
// AccountRegenerateAccountTokenHandler sets the operation handler for the regenerate account token operation
AccountRegenerateAccountTokenHandler account.RegenerateAccountTokenHandler
// AccountRegisterHandler sets the operation handler for the register operation
@ -422,9 +422,6 @@ func (o *ZrokAPI) Validate() error {
if o.AdminAddOrganizationMemberHandler == nil {
unregistered = append(unregistered, "admin.AddOrganizationMemberHandler")
}
if o.AgentAgentStatusHandler == nil {
unregistered = append(unregistered, "agent.AgentStatusHandler")
}
if o.AccountChangePasswordHandler == nil {
unregistered = append(unregistered, "account.ChangePasswordHandler")
}
@ -515,6 +512,9 @@ func (o *ZrokAPI) Validate() error {
if o.MetadataOverviewHandler == nil {
unregistered = append(unregistered, "metadata.OverviewHandler")
}
if o.AgentPingHandler == nil {
unregistered = append(unregistered, "agent.PingHandler")
}
if o.AccountRegenerateAccountTokenHandler == nil {
unregistered = append(unregistered, "account.RegenerateAccountTokenHandler")
}
@ -667,10 +667,6 @@ func (o *ZrokAPI) initHandlerCache() {
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/agent/status"] = agent.NewAgentStatus(o.context, o.AgentAgentStatusHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/changePassword"] = account.NewChangePassword(o.context, o.AccountChangePasswordHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
@ -791,6 +787,10 @@ func (o *ZrokAPI) initHandlerCache() {
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/agent/ping"] = agent.NewPing(o.context, o.AgentPingHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/regenerateAccountToken"] = account.NewRegenerateAccountToken(o.context, o.AccountRegenerateAccountTokenHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)

View File

@ -10,8 +10,6 @@ index.ts
models/Access201Response.ts
models/AccessRequest.ts
models/AddOrganizationMemberRequest.ts
models/AgentStatus200Response.ts
models/AgentStatusRequest.ts
models/AuthUser.ts
models/ChangePasswordRequest.ts
models/ClientVersionCheckRequest.ts
@ -42,6 +40,8 @@ models/Metrics.ts
models/MetricsSample.ts
models/ModelConfiguration.ts
models/Overview.ts
models/Ping200Response.ts
models/PingRequest.ts
models/Principal.ts
models/RegenerateAccountToken200Response.ts
models/RegenerateAccountTokenRequest.ts

View File

@ -15,18 +15,18 @@
import * as runtime from '../runtime';
import type {
AgentStatus200Response,
AgentStatusRequest,
Ping200Response,
PingRequest,
} from '../models/index';
import {
AgentStatus200ResponseFromJSON,
AgentStatus200ResponseToJSON,
AgentStatusRequestFromJSON,
AgentStatusRequestToJSON,
Ping200ResponseFromJSON,
Ping200ResponseToJSON,
PingRequestFromJSON,
PingRequestToJSON,
} from '../models/index';
export interface AgentStatusOperationRequest {
body?: AgentStatusRequest;
export interface PingOperationRequest {
body?: PingRequest;
}
/**
@ -36,7 +36,7 @@ export class AgentApi extends runtime.BaseAPI {
/**
*/
async agentStatusRaw(requestParameters: AgentStatusOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentStatus200Response>> {
async pingRaw(requestParameters: PingOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Ping200Response>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
@ -48,20 +48,20 @@ export class AgentApi extends runtime.BaseAPI {
}
const response = await this.request({
path: `/agent/status`,
path: `/agent/ping`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: AgentStatusRequestToJSON(requestParameters['body']),
body: PingRequestToJSON(requestParameters['body']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AgentStatus200ResponseFromJSON(jsonValue));
return new runtime.JSONApiResponse(response, (jsonValue) => Ping200ResponseFromJSON(jsonValue));
}
/**
*/
async agentStatus(requestParameters: AgentStatusOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentStatus200Response> {
const response = await this.agentStatusRaw(requestParameters, initOverrides);
async ping(requestParameters: PingOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Ping200Response> {
const response = await this.pingRaw(requestParameters, initOverrides);
return await response.value();
}

View File

@ -1,81 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { Share } from './Share';
import {
ShareFromJSON,
ShareFromJSONTyped,
ShareToJSON,
ShareToJSONTyped,
} from './Share';
/**
*
* @export
* @interface AgentStatus200Response
*/
export interface AgentStatus200Response {
/**
*
* @type {string}
* @memberof AgentStatus200Response
*/
version?: string;
/**
*
* @type {Array<Share>}
* @memberof AgentStatus200Response
*/
shares?: Array<Share>;
}
/**
* Check if a given object implements the AgentStatus200Response interface.
*/
export function instanceOfAgentStatus200Response(value: object): value is AgentStatus200Response {
return true;
}
export function AgentStatus200ResponseFromJSON(json: any): AgentStatus200Response {
return AgentStatus200ResponseFromJSONTyped(json, false);
}
export function AgentStatus200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentStatus200Response {
if (json == null) {
return json;
}
return {
'version': json['version'] == null ? undefined : json['version'],
'shares': json['shares'] == null ? undefined : ((json['shares'] as Array<any>).map(ShareFromJSON)),
};
}
export function AgentStatus200ResponseToJSON(json: any): AgentStatus200Response {
return AgentStatus200ResponseToJSONTyped(json, false);
}
export function AgentStatus200ResponseToJSONTyped(value?: AgentStatus200Response | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'version': value['version'],
'shares': value['shares'] == null ? undefined : ((value['shares'] as Array<any>).map(ShareToJSON)),
};
}

View File

@ -1,65 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface AgentStatusRequest
*/
export interface AgentStatusRequest {
/**
*
* @type {string}
* @memberof AgentStatusRequest
*/
envZId?: string;
}
/**
* Check if a given object implements the AgentStatusRequest interface.
*/
export function instanceOfAgentStatusRequest(value: object): value is AgentStatusRequest {
return true;
}
export function AgentStatusRequestFromJSON(json: any): AgentStatusRequest {
return AgentStatusRequestFromJSONTyped(json, false);
}
export function AgentStatusRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentStatusRequest {
if (json == null) {
return json;
}
return {
'envZId': json['envZId'] == null ? undefined : json['envZId'],
};
}
export function AgentStatusRequestToJSON(json: any): AgentStatusRequest {
return AgentStatusRequestToJSONTyped(json, false);
}
export function AgentStatusRequestToJSONTyped(value?: AgentStatusRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'envZId': value['envZId'],
};
}

View File

@ -0,0 +1,65 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface Ping200Response
*/
export interface Ping200Response {
/**
*
* @type {string}
* @memberof Ping200Response
*/
version?: string;
}
/**
* Check if a given object implements the Ping200Response interface.
*/
export function instanceOfPing200Response(value: object): value is Ping200Response {
return true;
}
export function Ping200ResponseFromJSON(json: any): Ping200Response {
return Ping200ResponseFromJSONTyped(json, false);
}
export function Ping200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ping200Response {
if (json == null) {
return json;
}
return {
'version': json['version'] == null ? undefined : json['version'],
};
}
export function Ping200ResponseToJSON(json: any): Ping200Response {
return Ping200ResponseToJSONTyped(json, false);
}
export function Ping200ResponseToJSONTyped(value?: Ping200Response | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'version': value['version'],
};
}

View File

@ -0,0 +1,65 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface PingRequest
*/
export interface PingRequest {
/**
*
* @type {string}
* @memberof PingRequest
*/
envZId?: string;
}
/**
* Check if a given object implements the PingRequest interface.
*/
export function instanceOfPingRequest(value: object): value is PingRequest {
return true;
}
export function PingRequestFromJSON(json: any): PingRequest {
return PingRequestFromJSONTyped(json, false);
}
export function PingRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PingRequest {
if (json == null) {
return json;
}
return {
'envZId': json['envZId'] == null ? undefined : json['envZId'],
};
}
export function PingRequestToJSON(json: any): PingRequest {
return PingRequestToJSONTyped(json, false);
}
export function PingRequestToJSONTyped(value?: PingRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'envZId': value['envZId'],
};
}

View File

@ -3,8 +3,6 @@
export * from './Access201Response';
export * from './AccessRequest';
export * from './AddOrganizationMemberRequest';
export * from './AgentStatus200Response';
export * from './AgentStatusRequest';
export * from './AuthUser';
export * from './ChangePasswordRequest';
export * from './ClientVersionCheckRequest';
@ -35,6 +33,8 @@ export * from './Metrics';
export * from './MetricsSample';
export * from './ModelConfiguration';
export * from './Overview';
export * from './Ping200Response';
export * from './PingRequest';
export * from './Principal';
export * from './RegenerateAccountToken200Response';
export * from './RegenerateAccountTokenRequest';

View File

@ -6,8 +6,6 @@ docs/AccountApi.md
docs/AddOrganizationMemberRequest.md
docs/AdminApi.md
docs/AgentApi.md
docs/AgentStatus200Response.md
docs/AgentStatusRequest.md
docs/AuthUser.md
docs/ChangePasswordRequest.md
docs/ClientVersionCheckRequest.md
@ -40,6 +38,8 @@ docs/MetadataApi.md
docs/Metrics.md
docs/MetricsSample.md
docs/Overview.md
docs/Ping200Response.md
docs/PingRequest.md
docs/Principal.md
docs/RegenerateAccountToken200Response.md
docs/RegenerateAccountTokenRequest.md
@ -68,8 +68,6 @@ test/test_account_api.py
test/test_add_organization_member_request.py
test/test_admin_api.py
test/test_agent_api.py
test/test_agent_status200_response.py
test/test_agent_status_request.py
test/test_auth_user.py
test/test_change_password_request.py
test/test_client_version_check_request.py
@ -102,6 +100,8 @@ test/test_metadata_api.py
test/test_metrics.py
test/test_metrics_sample.py
test/test_overview.py
test/test_ping200_response.py
test/test_ping_request.py
test/test_principal.py
test/test_regenerate_account_token200_response.py
test/test_regenerate_account_token_request.py
@ -137,8 +137,6 @@ zrok_api/models/__init__.py
zrok_api/models/access201_response.py
zrok_api/models/access_request.py
zrok_api/models/add_organization_member_request.py
zrok_api/models/agent_status200_response.py
zrok_api/models/agent_status_request.py
zrok_api/models/auth_user.py
zrok_api/models/change_password_request.py
zrok_api/models/client_version_check_request.py
@ -169,6 +167,8 @@ zrok_api/models/login_request.py
zrok_api/models/metrics.py
zrok_api/models/metrics_sample.py
zrok_api/models/overview.py
zrok_api/models/ping200_response.py
zrok_api/models/ping_request.py
zrok_api/models/principal.py
zrok_api/models/regenerate_account_token200_response.py
zrok_api/models/regenerate_account_token_request.py

View File

@ -114,7 +114,7 @@ Class | Method | HTTP request | Description
*AdminApi* | [**list_organizations**](docs/AdminApi.md#list_organizations) | **GET** /organizations |
*AdminApi* | [**remove_organization_member**](docs/AdminApi.md#remove_organization_member) | **POST** /organization/remove |
*AdminApi* | [**update_frontend**](docs/AdminApi.md#update_frontend) | **PATCH** /frontend |
*AgentApi* | [**agent_status**](docs/AgentApi.md#agent_status) | **POST** /agent/status |
*AgentApi* | [**ping**](docs/AgentApi.md#ping) | **POST** /agent/ping |
*EnvironmentApi* | [**disable**](docs/EnvironmentApi.md#disable) | **POST** /disable |
*EnvironmentApi* | [**enable**](docs/EnvironmentApi.md#enable) | **POST** /enable |
*MetadataApi* | [**client_version_check**](docs/MetadataApi.md#client_version_check) | **POST** /clientVersionCheck |
@ -146,8 +146,6 @@ Class | Method | HTTP request | Description
- [Access201Response](docs/Access201Response.md)
- [AccessRequest](docs/AccessRequest.md)
- [AddOrganizationMemberRequest](docs/AddOrganizationMemberRequest.md)
- [AgentStatus200Response](docs/AgentStatus200Response.md)
- [AgentStatusRequest](docs/AgentStatusRequest.md)
- [AuthUser](docs/AuthUser.md)
- [ChangePasswordRequest](docs/ChangePasswordRequest.md)
- [ClientVersionCheckRequest](docs/ClientVersionCheckRequest.md)
@ -178,6 +176,8 @@ Class | Method | HTTP request | Description
- [Metrics](docs/Metrics.md)
- [MetricsSample](docs/MetricsSample.md)
- [Overview](docs/Overview.md)
- [Ping200Response](docs/Ping200Response.md)
- [PingRequest](docs/PingRequest.md)
- [Principal](docs/Principal.md)
- [RegenerateAccountToken200Response](docs/RegenerateAccountToken200Response.md)
- [RegenerateAccountTokenRequest](docs/RegenerateAccountTokenRequest.md)

View File

@ -4,11 +4,11 @@ All URIs are relative to */api/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**agent_status**](AgentApi.md#agent_status) | **POST** /agent/status |
[**ping**](AgentApi.md#ping) | **POST** /agent/ping |
# **agent_status**
> AgentStatus200Response agent_status(body=body)
# **ping**
> Ping200Response ping(body=body)
### Example
@ -16,8 +16,8 @@ Method | HTTP request | Description
```python
import zrok_api
from zrok_api.models.agent_status200_response import AgentStatus200Response
from zrok_api.models.agent_status_request import AgentStatusRequest
from zrok_api.models.ping200_response import Ping200Response
from zrok_api.models.ping_request import PingRequest
from zrok_api.rest import ApiException
from pprint import pprint
@ -42,14 +42,14 @@ configuration.api_key['key'] = os.environ["API_KEY"]
with zrok_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = zrok_api.AgentApi(api_client)
body = zrok_api.AgentStatusRequest() # AgentStatusRequest | (optional)
body = zrok_api.PingRequest() # PingRequest | (optional)
try:
api_response = api_instance.agent_status(body=body)
print("The response of AgentApi->agent_status:\n")
api_response = api_instance.ping(body=body)
print("The response of AgentApi->ping:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling AgentApi->agent_status: %s\n" % e)
print("Exception when calling AgentApi->ping: %s\n" % e)
```
@ -59,11 +59,11 @@ with zrok_api.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**AgentStatusRequest**](AgentStatusRequest.md)| | [optional]
**body** | [**PingRequest**](PingRequest.md)| | [optional]
### Return type
[**AgentStatus200Response**](AgentStatus200Response.md)
[**Ping200Response**](Ping200Response.md)
### Authorization
@ -81,6 +81,7 @@ Name | Type | Description | Notes
**200** | ok | - |
**401** | unauthorized | - |
**500** | internal server error | - |
**502** | bad gateway; agent not reachable | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,30 +0,0 @@
# AgentStatus200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**version** | **str** | | [optional]
**shares** | [**List[Share]**](Share.md) | | [optional]
## Example
```python
from zrok_api.models.agent_status200_response import AgentStatus200Response
# TODO update the JSON string below
json = "{}"
# create an instance of AgentStatus200Response from a JSON string
agent_status200_response_instance = AgentStatus200Response.from_json(json)
# print the JSON string representation of the object
print(AgentStatus200Response.to_json())
# convert the object into a dict
agent_status200_response_dict = agent_status200_response_instance.to_dict()
# create an instance of AgentStatus200Response from a dict
agent_status200_response_from_dict = AgentStatus200Response.from_dict(agent_status200_response_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,29 @@
# Ping200Response
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**version** | **str** | | [optional]
## Example
```python
from zrok_api.models.ping200_response import Ping200Response
# TODO update the JSON string below
json = "{}"
# create an instance of Ping200Response from a JSON string
ping200_response_instance = Ping200Response.from_json(json)
# print the JSON string representation of the object
print(Ping200Response.to_json())
# convert the object into a dict
ping200_response_dict = ping200_response_instance.to_dict()
# create an instance of Ping200Response from a dict
ping200_response_from_dict = Ping200Response.from_dict(ping200_response_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,4 +1,4 @@
# AgentStatusRequest
# PingRequest
## Properties
@ -10,19 +10,19 @@ Name | Type | Description | Notes
## Example
```python
from zrok_api.models.agent_status_request import AgentStatusRequest
from zrok_api.models.ping_request import PingRequest
# TODO update the JSON string below
json = "{}"
# create an instance of AgentStatusRequest from a JSON string
agent_status_request_instance = AgentStatusRequest.from_json(json)
# create an instance of PingRequest from a JSON string
ping_request_instance = PingRequest.from_json(json)
# print the JSON string representation of the object
print(AgentStatusRequest.to_json())
print(PingRequest.to_json())
# convert the object into a dict
agent_status_request_dict = agent_status_request_instance.to_dict()
# create an instance of AgentStatusRequest from a dict
agent_status_request_from_dict = AgentStatusRequest.from_dict(agent_status_request_dict)
ping_request_dict = ping_request_instance.to_dict()
# create an instance of PingRequest from a dict
ping_request_from_dict = PingRequest.from_dict(ping_request_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -26,8 +26,8 @@ class TestAgentApi(unittest.TestCase):
def tearDown(self) -> None:
pass
def test_agent_status(self) -> None:
"""Test case for agent_status
def test_ping(self) -> None:
"""Test case for ping
"""
pass

View File

@ -1,70 +0,0 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from zrok_api.models.agent_status200_response import AgentStatus200Response
class TestAgentStatus200Response(unittest.TestCase):
"""AgentStatus200Response unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> AgentStatus200Response:
"""Test AgentStatus200Response
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `AgentStatus200Response`
"""
model = AgentStatus200Response()
if include_optional:
return AgentStatus200Response(
version = '',
shares = [
zrok_api.models.share.share(
share_token = '',
z_id = '',
share_mode = '',
backend_mode = '',
frontend_selection = '',
frontend_endpoint = '',
backend_proxy_endpoint = '',
reserved = True,
activity = [
zrok_api.models.spark_data_sample.sparkDataSample(
rx = 1.337,
tx = 1.337, )
],
limited = True,
created_at = 56,
updated_at = 56, )
]
)
else:
return AgentStatus200Response(
)
"""
def testAgentStatus200Response(self):
"""Test AgentStatus200Response"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,51 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from zrok_api.models.ping200_response import Ping200Response
class TestPing200Response(unittest.TestCase):
"""Ping200Response unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Ping200Response:
"""Test Ping200Response
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `Ping200Response`
"""
model = Ping200Response()
if include_optional:
return Ping200Response(
version = ''
)
else:
return Ping200Response(
)
"""
def testPing200Response(self):
"""Test Ping200Response"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@ -14,10 +14,10 @@
import unittest
from zrok_api.models.agent_status_request import AgentStatusRequest
from zrok_api.models.ping_request import PingRequest
class TestAgentStatusRequest(unittest.TestCase):
"""AgentStatusRequest unit test stubs"""
class TestPingRequest(unittest.TestCase):
"""PingRequest unit test stubs"""
def setUp(self):
pass
@ -25,25 +25,25 @@ class TestAgentStatusRequest(unittest.TestCase):
def tearDown(self):
pass
def make_instance(self, include_optional) -> AgentStatusRequest:
"""Test AgentStatusRequest
def make_instance(self, include_optional) -> PingRequest:
"""Test PingRequest
include_optional is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `AgentStatusRequest`
# uncomment below to create an instance of `PingRequest`
"""
model = AgentStatusRequest()
model = PingRequest()
if include_optional:
return AgentStatusRequest(
return PingRequest(
env_zid = ''
)
else:
return AgentStatusRequest(
return PingRequest(
)
"""
def testAgentStatusRequest(self):
"""Test AgentStatusRequest"""
def testPingRequest(self):
"""Test PingRequest"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)

View File

@ -39,8 +39,6 @@ from zrok_api.exceptions import ApiException
from zrok_api.models.access201_response import Access201Response
from zrok_api.models.access_request import AccessRequest
from zrok_api.models.add_organization_member_request import AddOrganizationMemberRequest
from zrok_api.models.agent_status200_response import AgentStatus200Response
from zrok_api.models.agent_status_request import AgentStatusRequest
from zrok_api.models.auth_user import AuthUser
from zrok_api.models.change_password_request import ChangePasswordRequest
from zrok_api.models.client_version_check_request import ClientVersionCheckRequest
@ -71,6 +69,8 @@ from zrok_api.models.login_request import LoginRequest
from zrok_api.models.metrics import Metrics
from zrok_api.models.metrics_sample import MetricsSample
from zrok_api.models.overview import Overview
from zrok_api.models.ping200_response import Ping200Response
from zrok_api.models.ping_request import PingRequest
from zrok_api.models.principal import Principal
from zrok_api.models.regenerate_account_token200_response import RegenerateAccountToken200Response
from zrok_api.models.regenerate_account_token_request import RegenerateAccountTokenRequest

View File

@ -17,8 +17,8 @@ from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated
from typing import Optional
from zrok_api.models.agent_status200_response import AgentStatus200Response
from zrok_api.models.agent_status_request import AgentStatusRequest
from zrok_api.models.ping200_response import Ping200Response
from zrok_api.models.ping_request import PingRequest
from zrok_api.api_client import ApiClient, RequestSerialized
from zrok_api.api_response import ApiResponse
@ -39,9 +39,9 @@ class AgentApi:
@validate_call
def agent_status(
def ping(
self,
body: Optional[AgentStatusRequest] = None,
body: Optional[PingRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@ -54,12 +54,12 @@ class AgentApi:
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> AgentStatus200Response:
"""agent_status
) -> Ping200Response:
"""ping
:param body:
:type body: AgentStatusRequest
:type body: PingRequest
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
@ -82,7 +82,7 @@ class AgentApi:
:return: Returns the result object.
""" # noqa: E501
_param = self._agent_status_serialize(
_param = self._ping_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
@ -91,9 +91,10 @@ class AgentApi:
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "AgentStatus200Response",
'200': "Ping200Response",
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
@ -107,9 +108,9 @@ class AgentApi:
@validate_call
def agent_status_with_http_info(
def ping_with_http_info(
self,
body: Optional[AgentStatusRequest] = None,
body: Optional[PingRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@ -122,12 +123,12 @@ class AgentApi:
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[AgentStatus200Response]:
"""agent_status
) -> ApiResponse[Ping200Response]:
"""ping
:param body:
:type body: AgentStatusRequest
:type body: PingRequest
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
@ -150,7 +151,7 @@ class AgentApi:
:return: Returns the result object.
""" # noqa: E501
_param = self._agent_status_serialize(
_param = self._ping_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
@ -159,9 +160,10 @@ class AgentApi:
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "AgentStatus200Response",
'200': "Ping200Response",
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
@ -175,9 +177,9 @@ class AgentApi:
@validate_call
def agent_status_without_preload_content(
def ping_without_preload_content(
self,
body: Optional[AgentStatusRequest] = None,
body: Optional[PingRequest] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@ -191,11 +193,11 @@ class AgentApi:
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""agent_status
"""ping
:param body:
:type body: AgentStatusRequest
:type body: PingRequest
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
@ -218,7 +220,7 @@ class AgentApi:
:return: Returns the result object.
""" # noqa: E501
_param = self._agent_status_serialize(
_param = self._ping_serialize(
body=body,
_request_auth=_request_auth,
_content_type=_content_type,
@ -227,9 +229,10 @@ class AgentApi:
)
_response_types_map: Dict[str, Optional[str]] = {
'200': "AgentStatus200Response",
'200': "Ping200Response",
'401': None,
'500': None,
'502': None,
}
response_data = self.api_client.call_api(
*_param,
@ -238,7 +241,7 @@ class AgentApi:
return response_data.response
def _agent_status_serialize(
def _ping_serialize(
self,
body,
_request_auth,
@ -299,7 +302,7 @@ class AgentApi:
return self.api_client.param_serialize(
method='POST',
resource_path='/agent/status',
resource_path='/agent/ping',
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,

View File

@ -17,8 +17,6 @@
from zrok_api.models.access201_response import Access201Response
from zrok_api.models.access_request import AccessRequest
from zrok_api.models.add_organization_member_request import AddOrganizationMemberRequest
from zrok_api.models.agent_status200_response import AgentStatus200Response
from zrok_api.models.agent_status_request import AgentStatusRequest
from zrok_api.models.auth_user import AuthUser
from zrok_api.models.change_password_request import ChangePasswordRequest
from zrok_api.models.client_version_check_request import ClientVersionCheckRequest
@ -49,6 +47,8 @@ from zrok_api.models.login_request import LoginRequest
from zrok_api.models.metrics import Metrics
from zrok_api.models.metrics_sample import MetricsSample
from zrok_api.models.overview import Overview
from zrok_api.models.ping200_response import Ping200Response
from zrok_api.models.ping_request import PingRequest
from zrok_api.models.principal import Principal
from zrok_api.models.regenerate_account_token200_response import RegenerateAccountToken200Response
from zrok_api.models.regenerate_account_token_request import RegenerateAccountTokenRequest

View File

@ -19,17 +19,15 @@ import json
from pydantic import BaseModel, ConfigDict, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from zrok_api.models.share import Share
from typing import Optional, Set
from typing_extensions import Self
class AgentStatus200Response(BaseModel):
class Ping200Response(BaseModel):
"""
AgentStatus200Response
Ping200Response
""" # noqa: E501
version: Optional[StrictStr] = None
shares: Optional[List[Share]] = None
__properties: ClassVar[List[str]] = ["version", "shares"]
__properties: ClassVar[List[str]] = ["version"]
model_config = ConfigDict(
populate_by_name=True,
@ -49,7 +47,7 @@ class AgentStatus200Response(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of AgentStatus200Response from a JSON string"""
"""Create an instance of Ping200Response from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
@ -70,18 +68,11 @@ class AgentStatus200Response(BaseModel):
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in shares (list)
_items = []
if self.shares:
for _item_shares in self.shares:
if _item_shares:
_items.append(_item_shares.to_dict())
_dict['shares'] = _items
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of AgentStatus200Response from a dict"""
"""Create an instance of Ping200Response from a dict"""
if obj is None:
return None
@ -89,8 +80,7 @@ class AgentStatus200Response(BaseModel):
return cls.model_validate(obj)
_obj = cls.model_validate({
"version": obj.get("version"),
"shares": [Share.from_dict(_item) for _item in obj["shares"]] if obj.get("shares") is not None else None
"version": obj.get("version")
})
return _obj

View File

@ -22,9 +22,9 @@ from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class AgentStatusRequest(BaseModel):
class PingRequest(BaseModel):
"""
AgentStatusRequest
PingRequest
""" # noqa: E501
env_zid: Optional[StrictStr] = Field(default=None, alias="envZId")
__properties: ClassVar[List[str]] = ["envZId"]
@ -47,7 +47,7 @@ class AgentStatusRequest(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of AgentStatusRequest from a JSON string"""
"""Create an instance of PingRequest from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
@ -72,7 +72,7 @@ class AgentStatusRequest(BaseModel):
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of AgentStatusRequest from a dict"""
"""Create an instance of PingRequest from a dict"""
if obj is None:
return None

View File

@ -616,13 +616,13 @@ paths:
#
# agent
#
/agent/status:
/agent/ping:
post:
tags:
- agent
security:
- key: []
operationId: agentStatus
operationId: ping
parameters:
- name: body
in: body
@ -637,14 +637,12 @@ paths:
properties:
version:
type: string
shares:
type: array
items:
$ref: "#/definitions/share"
401:
description: unauthorized
500:
description: internal server error
502:
description: bad gateway; agent not reachable
#
# environment

View File

@ -10,8 +10,6 @@ index.ts
models/Access201Response.ts
models/AccessRequest.ts
models/AddOrganizationMemberRequest.ts
models/AgentStatus200Response.ts
models/AgentStatusRequest.ts
models/AuthUser.ts
models/ChangePasswordRequest.ts
models/ClientVersionCheckRequest.ts
@ -42,6 +40,8 @@ models/Metrics.ts
models/MetricsSample.ts
models/ModelConfiguration.ts
models/Overview.ts
models/Ping200Response.ts
models/PingRequest.ts
models/Principal.ts
models/RegenerateAccountToken200Response.ts
models/RegenerateAccountTokenRequest.ts

View File

@ -15,18 +15,18 @@
import * as runtime from '../runtime';
import type {
AgentStatus200Response,
AgentStatusRequest,
Ping200Response,
PingRequest,
} from '../models/index';
import {
AgentStatus200ResponseFromJSON,
AgentStatus200ResponseToJSON,
AgentStatusRequestFromJSON,
AgentStatusRequestToJSON,
Ping200ResponseFromJSON,
Ping200ResponseToJSON,
PingRequestFromJSON,
PingRequestToJSON,
} from '../models/index';
export interface AgentStatusOperationRequest {
body?: AgentStatusRequest;
export interface PingOperationRequest {
body?: PingRequest;
}
/**
@ -36,7 +36,7 @@ export class AgentApi extends runtime.BaseAPI {
/**
*/
async agentStatusRaw(requestParameters: AgentStatusOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentStatus200Response>> {
async pingRaw(requestParameters: PingOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Ping200Response>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
@ -48,20 +48,20 @@ export class AgentApi extends runtime.BaseAPI {
}
const response = await this.request({
path: `/agent/status`,
path: `/agent/ping`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: AgentStatusRequestToJSON(requestParameters['body']),
body: PingRequestToJSON(requestParameters['body']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AgentStatus200ResponseFromJSON(jsonValue));
return new runtime.JSONApiResponse(response, (jsonValue) => Ping200ResponseFromJSON(jsonValue));
}
/**
*/
async agentStatus(requestParameters: AgentStatusOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentStatus200Response> {
const response = await this.agentStatusRaw(requestParameters, initOverrides);
async ping(requestParameters: PingOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Ping200Response> {
const response = await this.pingRaw(requestParameters, initOverrides);
return await response.value();
}

View File

@ -1,81 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { Share } from './Share';
import {
ShareFromJSON,
ShareFromJSONTyped,
ShareToJSON,
ShareToJSONTyped,
} from './Share';
/**
*
* @export
* @interface AgentStatus200Response
*/
export interface AgentStatus200Response {
/**
*
* @type {string}
* @memberof AgentStatus200Response
*/
version?: string;
/**
*
* @type {Array<Share>}
* @memberof AgentStatus200Response
*/
shares?: Array<Share>;
}
/**
* Check if a given object implements the AgentStatus200Response interface.
*/
export function instanceOfAgentStatus200Response(value: object): value is AgentStatus200Response {
return true;
}
export function AgentStatus200ResponseFromJSON(json: any): AgentStatus200Response {
return AgentStatus200ResponseFromJSONTyped(json, false);
}
export function AgentStatus200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentStatus200Response {
if (json == null) {
return json;
}
return {
'version': json['version'] == null ? undefined : json['version'],
'shares': json['shares'] == null ? undefined : ((json['shares'] as Array<any>).map(ShareFromJSON)),
};
}
export function AgentStatus200ResponseToJSON(json: any): AgentStatus200Response {
return AgentStatus200ResponseToJSONTyped(json, false);
}
export function AgentStatus200ResponseToJSONTyped(value?: AgentStatus200Response | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'version': value['version'],
'shares': value['shares'] == null ? undefined : ((value['shares'] as Array<any>).map(ShareToJSON)),
};
}

View File

@ -1,65 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface AgentStatusRequest
*/
export interface AgentStatusRequest {
/**
*
* @type {string}
* @memberof AgentStatusRequest
*/
envZId?: string;
}
/**
* Check if a given object implements the AgentStatusRequest interface.
*/
export function instanceOfAgentStatusRequest(value: object): value is AgentStatusRequest {
return true;
}
export function AgentStatusRequestFromJSON(json: any): AgentStatusRequest {
return AgentStatusRequestFromJSONTyped(json, false);
}
export function AgentStatusRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentStatusRequest {
if (json == null) {
return json;
}
return {
'envZId': json['envZId'] == null ? undefined : json['envZId'],
};
}
export function AgentStatusRequestToJSON(json: any): AgentStatusRequest {
return AgentStatusRequestToJSONTyped(json, false);
}
export function AgentStatusRequestToJSONTyped(value?: AgentStatusRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'envZId': value['envZId'],
};
}

View File

@ -0,0 +1,65 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface Ping200Response
*/
export interface Ping200Response {
/**
*
* @type {string}
* @memberof Ping200Response
*/
version?: string;
}
/**
* Check if a given object implements the Ping200Response interface.
*/
export function instanceOfPing200Response(value: object): value is Ping200Response {
return true;
}
export function Ping200ResponseFromJSON(json: any): Ping200Response {
return Ping200ResponseFromJSONTyped(json, false);
}
export function Ping200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ping200Response {
if (json == null) {
return json;
}
return {
'version': json['version'] == null ? undefined : json['version'],
};
}
export function Ping200ResponseToJSON(json: any): Ping200Response {
return Ping200ResponseToJSONTyped(json, false);
}
export function Ping200ResponseToJSONTyped(value?: Ping200Response | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'version': value['version'],
};
}

View File

@ -0,0 +1,65 @@
/* tslint:disable */
/* eslint-disable */
/**
* zrok
* zrok client access
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface PingRequest
*/
export interface PingRequest {
/**
*
* @type {string}
* @memberof PingRequest
*/
envZId?: string;
}
/**
* Check if a given object implements the PingRequest interface.
*/
export function instanceOfPingRequest(value: object): value is PingRequest {
return true;
}
export function PingRequestFromJSON(json: any): PingRequest {
return PingRequestFromJSONTyped(json, false);
}
export function PingRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PingRequest {
if (json == null) {
return json;
}
return {
'envZId': json['envZId'] == null ? undefined : json['envZId'],
};
}
export function PingRequestToJSON(json: any): PingRequest {
return PingRequestToJSONTyped(json, false);
}
export function PingRequestToJSONTyped(value?: PingRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'envZId': value['envZId'],
};
}

View File

@ -3,8 +3,6 @@
export * from './Access201Response';
export * from './AccessRequest';
export * from './AddOrganizationMemberRequest';
export * from './AgentStatus200Response';
export * from './AgentStatusRequest';
export * from './AuthUser';
export * from './ChangePasswordRequest';
export * from './ClientVersionCheckRequest';
@ -35,6 +33,8 @@ export * from './Metrics';
export * from './MetricsSample';
export * from './ModelConfiguration';
export * from './Overview';
export * from './Ping200Response';
export * from './PingRequest';
export * from './Principal';
export * from './RegenerateAccountToken200Response';
export * from './RegenerateAccountTokenRequest';