diff --git a/controller/agentShareHttpHealthcheck.go b/controller/agentShareHttpHealthcheck.go new file mode 100644 index 00000000..aa9031a1 --- /dev/null +++ b/controller/agentShareHttpHealthcheck.go @@ -0,0 +1,66 @@ +package controller + +import ( + "context" + "fmt" + + "github.com/go-openapi/runtime/middleware" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/controller/agentController" + "github.com/openziti/zrok/rest_model_zrok" + "github.com/openziti/zrok/rest_server_zrok/operations/agent" + "github.com/sirupsen/logrus" +) + +type agentShareHttpHealthcheckHandler struct{} + +func newAgentShareHttpHealthcheckHandler() *agentShareHttpHealthcheckHandler { + return &agentShareHttpHealthcheckHandler{} +} + +func (h *agentShareHttpHealthcheckHandler) Handle(params agent.ShareHTTPHealthcheckParams, principal *rest_model_zrok.Principal) middleware.Responder { + trx, err := str.Begin() + if err != nil { + logrus.Errorf("error starting transaction for '%v': %v", principal.Email, err) + return agent.NewShareHTTPHealthcheckInternalServerError() + } + defer trx.Rollback() + + env, err := str.FindEnvironmentForAccount(params.Body.EnvZID, int(principal.ID), trx) + if err != nil { + logrus.Errorf("error finding environment '%v' for '%v': %v", params.Body.EnvZID, principal.Email, err) + return agent.NewShareHTTPHealthcheckUnauthorized() + } + + ae, err := str.FindAgentEnrollmentForEnvironment(env.Id, trx) + if err != nil { + logrus.Errorf("error finding agent enrollment for environment '%v' (%v): %v", params.Body.EnvZID, principal.Email, err) + return agent.NewShareHTTPHealthcheckBadGateway() + } + _ = trx.Rollback() // ...or will block share trx on sqlite + + acli, aconn, err := agentController.NewAgentClient(ae.Token, cfg.AgentController) + if err != nil { + logrus.Errorf("error creating agent client for '%v' (%v): %v", params.Body.EnvZID, principal.Email, err) + return agent.NewShareHTTPHealthcheckInternalServerError() + } + defer aconn.Close() + + req := &agentGrpc.HttpShareHealthcheckRequest{ + Token: params.Body.ShareToken, + HttpVerb: params.Body.HTTPVerb, + Endpoint: params.Body.Endpoint, + ExpectedHttpResponse: fmt.Sprintf("%v", params.Body.ExpectedHTTPResponse), + TimeoutMs: uint64(params.Body.TimeoutMs), + } + resp, err := acli.HttpShareHealthcheck(context.Background(), req) + if err != nil { + logrus.Infof("error invoking remoted share '%v' http healthcheck for '%v': %v", params.Body.ShareToken, params.Body.EnvZID, err) + return agent.NewShareHTTPHealthcheckBadGateway() + } + + return agent.NewShareHTTPHealthcheckOK().WithPayload(&agent.ShareHTTPHealthcheckOKBody{ + Healthy: resp.Healthy, + Error: resp.Error, + }) +} diff --git a/controller/controller.go b/controller/controller.go index 71708b0a..8d56da3b 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -78,6 +78,7 @@ func Run(inCfg *config.Config) error { api.AgentRemoteStatusHandler = newAgentRemoteStatusHandler() api.AgentRemoteUnaccessHandler = newAgentRemoteUnaccessHandler() api.AgentRemoteUnshareHandler = newAgentRemoteUnshareHandler() + api.AgentShareHTTPHealthcheckHandler = newAgentShareHttpHealthcheckHandler() api.AgentUnenrollHandler = newAgentUnenrollHandler() } api.EnvironmentEnableHandler = newEnableHandler() diff --git a/rest_client_zrok/agent/agent_client.go b/rest_client_zrok/agent/agent_client.go index 9183aa81..e3e42c46 100644 --- a/rest_client_zrok/agent/agent_client.go +++ b/rest_client_zrok/agent/agent_client.go @@ -32,8 +32,6 @@ type ClientOption func(*runtime.ClientOperation) type ClientService interface { Enroll(params *EnrollParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EnrollOK, error) - HTTPHealthcheck(params *HTTPHealthcheckParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HTTPHealthcheckOK, error) - Ping(params *PingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PingOK, error) RemoteAccess(params *RemoteAccessParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RemoteAccessOK, error) @@ -46,6 +44,8 @@ type ClientService interface { RemoteUnshare(params *RemoteUnshareParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RemoteUnshareOK, error) + ShareHTTPHealthcheck(params *ShareHTTPHealthcheckParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ShareHTTPHealthcheckOK, error) + Unenroll(params *UnenrollParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnenrollOK, error) SetTransport(transport runtime.ClientTransport) @@ -90,45 +90,6 @@ func (a *Client) Enroll(params *EnrollParams, authInfo runtime.ClientAuthInfoWri panic(msg) } -/* -HTTPHealthcheck http healthcheck API -*/ -func (a *Client) HTTPHealthcheck(params *HTTPHealthcheckParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HTTPHealthcheckOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewHTTPHealthcheckParams() - } - op := &runtime.ClientOperation{ - ID: "httpHealthcheck", - Method: "POST", - PathPattern: "/agent/share/http-healthcheck", - ProducesMediaTypes: []string{"application/zrok.v1+json"}, - ConsumesMediaTypes: []string{"application/zrok.v1+json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &HTTPHealthcheckReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*HTTPHealthcheckOK) - 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 httpHealthcheck: API contract not enforced by server. Client expected to get an error, but got: %T", result) - panic(msg) -} - /* Ping ping API */ @@ -363,6 +324,45 @@ func (a *Client) RemoteUnshare(params *RemoteUnshareParams, authInfo runtime.Cli panic(msg) } +/* +ShareHTTPHealthcheck share Http healthcheck API +*/ +func (a *Client) ShareHTTPHealthcheck(params *ShareHTTPHealthcheckParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ShareHTTPHealthcheckOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewShareHTTPHealthcheckParams() + } + op := &runtime.ClientOperation{ + ID: "shareHttpHealthcheck", + Method: "POST", + PathPattern: "/agent/share/http-healthcheck", + ProducesMediaTypes: []string{"application/zrok.v1+json"}, + ConsumesMediaTypes: []string{"application/zrok.v1+json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ShareHTTPHealthcheckReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ShareHTTPHealthcheckOK) + 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 shareHttpHealthcheck: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* Unenroll unenroll API */ diff --git a/rest_client_zrok/agent/http_healthcheck_parameters.go b/rest_client_zrok/agent/http_healthcheck_parameters.go deleted file mode 100644 index a7878edc..00000000 --- a/rest_client_zrok/agent/http_healthcheck_parameters.go +++ /dev/null @@ -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" -) - -// NewHTTPHealthcheckParams creates a new HTTPHealthcheckParams 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 NewHTTPHealthcheckParams() *HTTPHealthcheckParams { - return &HTTPHealthcheckParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewHTTPHealthcheckParamsWithTimeout creates a new HTTPHealthcheckParams object -// with the ability to set a timeout on a request. -func NewHTTPHealthcheckParamsWithTimeout(timeout time.Duration) *HTTPHealthcheckParams { - return &HTTPHealthcheckParams{ - timeout: timeout, - } -} - -// NewHTTPHealthcheckParamsWithContext creates a new HTTPHealthcheckParams object -// with the ability to set a context for a request. -func NewHTTPHealthcheckParamsWithContext(ctx context.Context) *HTTPHealthcheckParams { - return &HTTPHealthcheckParams{ - Context: ctx, - } -} - -// NewHTTPHealthcheckParamsWithHTTPClient creates a new HTTPHealthcheckParams object -// with the ability to set a custom HTTPClient for a request. -func NewHTTPHealthcheckParamsWithHTTPClient(client *http.Client) *HTTPHealthcheckParams { - return &HTTPHealthcheckParams{ - HTTPClient: client, - } -} - -/* -HTTPHealthcheckParams contains all the parameters to send to the API endpoint - - for the http healthcheck operation. - - Typically these are written to a http.Request. -*/ -type HTTPHealthcheckParams struct { - - // Body. - Body HTTPHealthcheckBody - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the http healthcheck params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *HTTPHealthcheckParams) WithDefaults() *HTTPHealthcheckParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the http healthcheck params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *HTTPHealthcheckParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the http healthcheck params -func (o *HTTPHealthcheckParams) WithTimeout(timeout time.Duration) *HTTPHealthcheckParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the http healthcheck params -func (o *HTTPHealthcheckParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the http healthcheck params -func (o *HTTPHealthcheckParams) WithContext(ctx context.Context) *HTTPHealthcheckParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the http healthcheck params -func (o *HTTPHealthcheckParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the http healthcheck params -func (o *HTTPHealthcheckParams) WithHTTPClient(client *http.Client) *HTTPHealthcheckParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the http healthcheck params -func (o *HTTPHealthcheckParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the http healthcheck params -func (o *HTTPHealthcheckParams) WithBody(body HTTPHealthcheckBody) *HTTPHealthcheckParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the http healthcheck params -func (o *HTTPHealthcheckParams) SetBody(body HTTPHealthcheckBody) { - o.Body = body -} - -// WriteToRequest writes these params to a swagger request -func (o *HTTPHealthcheckParams) 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 -} diff --git a/rest_client_zrok/agent/http_healthcheck_responses.go b/rest_client_zrok/agent/http_healthcheck_responses.go deleted file mode 100644 index a936126f..00000000 --- a/rest_client_zrok/agent/http_healthcheck_responses.go +++ /dev/null @@ -1,383 +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" - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HTTPHealthcheckReader is a Reader for the HTTPHealthcheck structure. -type HTTPHealthcheckReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *HTTPHealthcheckReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewHTTPHealthcheckOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - case 401: - result := NewHTTPHealthcheckUnauthorized() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 500: - result := NewHTTPHealthcheckInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - case 502: - result := NewHTTPHealthcheckBadGateway() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - default: - return nil, runtime.NewAPIError("[POST /agent/share/http-healthcheck] httpHealthcheck", response, response.Code()) - } -} - -// NewHTTPHealthcheckOK creates a HTTPHealthcheckOK with default headers values -func NewHTTPHealthcheckOK() *HTTPHealthcheckOK { - return &HTTPHealthcheckOK{} -} - -/* -HTTPHealthcheckOK describes a response with status code 200, with default header values. - -ok -*/ -type HTTPHealthcheckOK struct { - Payload *HTTPHealthcheckOKBody -} - -// IsSuccess returns true when this http healthcheck o k response has a 2xx status code -func (o *HTTPHealthcheckOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this http healthcheck o k response has a 3xx status code -func (o *HTTPHealthcheckOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this http healthcheck o k response has a 4xx status code -func (o *HTTPHealthcheckOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this http healthcheck o k response has a 5xx status code -func (o *HTTPHealthcheckOK) IsServerError() bool { - return false -} - -// IsCode returns true when this http healthcheck o k response a status code equal to that given -func (o *HTTPHealthcheckOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the http healthcheck o k response -func (o *HTTPHealthcheckOK) Code() int { - return 200 -} - -func (o *HTTPHealthcheckOK) Error() string { - return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] httpHealthcheckOK %+v", 200, o.Payload) -} - -func (o *HTTPHealthcheckOK) String() string { - return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] httpHealthcheckOK %+v", 200, o.Payload) -} - -func (o *HTTPHealthcheckOK) GetPayload() *HTTPHealthcheckOKBody { - return o.Payload -} - -func (o *HTTPHealthcheckOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(HTTPHealthcheckOKBody) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewHTTPHealthcheckUnauthorized creates a HTTPHealthcheckUnauthorized with default headers values -func NewHTTPHealthcheckUnauthorized() *HTTPHealthcheckUnauthorized { - return &HTTPHealthcheckUnauthorized{} -} - -/* -HTTPHealthcheckUnauthorized describes a response with status code 401, with default header values. - -unauthorized -*/ -type HTTPHealthcheckUnauthorized struct { -} - -// IsSuccess returns true when this http healthcheck unauthorized response has a 2xx status code -func (o *HTTPHealthcheckUnauthorized) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this http healthcheck unauthorized response has a 3xx status code -func (o *HTTPHealthcheckUnauthorized) IsRedirect() bool { - return false -} - -// IsClientError returns true when this http healthcheck unauthorized response has a 4xx status code -func (o *HTTPHealthcheckUnauthorized) IsClientError() bool { - return true -} - -// IsServerError returns true when this http healthcheck unauthorized response has a 5xx status code -func (o *HTTPHealthcheckUnauthorized) IsServerError() bool { - return false -} - -// IsCode returns true when this http healthcheck unauthorized response a status code equal to that given -func (o *HTTPHealthcheckUnauthorized) IsCode(code int) bool { - return code == 401 -} - -// Code gets the status code for the http healthcheck unauthorized response -func (o *HTTPHealthcheckUnauthorized) Code() int { - return 401 -} - -func (o *HTTPHealthcheckUnauthorized) Error() string { - return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] httpHealthcheckUnauthorized ", 401) -} - -func (o *HTTPHealthcheckUnauthorized) String() string { - return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] httpHealthcheckUnauthorized ", 401) -} - -func (o *HTTPHealthcheckUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewHTTPHealthcheckInternalServerError creates a HTTPHealthcheckInternalServerError with default headers values -func NewHTTPHealthcheckInternalServerError() *HTTPHealthcheckInternalServerError { - return &HTTPHealthcheckInternalServerError{} -} - -/* -HTTPHealthcheckInternalServerError describes a response with status code 500, with default header values. - -internal server error -*/ -type HTTPHealthcheckInternalServerError struct { -} - -// IsSuccess returns true when this http healthcheck internal server error response has a 2xx status code -func (o *HTTPHealthcheckInternalServerError) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this http healthcheck internal server error response has a 3xx status code -func (o *HTTPHealthcheckInternalServerError) IsRedirect() bool { - return false -} - -// IsClientError returns true when this http healthcheck internal server error response has a 4xx status code -func (o *HTTPHealthcheckInternalServerError) IsClientError() bool { - return false -} - -// IsServerError returns true when this http healthcheck internal server error response has a 5xx status code -func (o *HTTPHealthcheckInternalServerError) IsServerError() bool { - return true -} - -// IsCode returns true when this http healthcheck internal server error response a status code equal to that given -func (o *HTTPHealthcheckInternalServerError) IsCode(code int) bool { - return code == 500 -} - -// Code gets the status code for the http healthcheck internal server error response -func (o *HTTPHealthcheckInternalServerError) Code() int { - return 500 -} - -func (o *HTTPHealthcheckInternalServerError) Error() string { - return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] httpHealthcheckInternalServerError ", 500) -} - -func (o *HTTPHealthcheckInternalServerError) String() string { - return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] httpHealthcheckInternalServerError ", 500) -} - -func (o *HTTPHealthcheckInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewHTTPHealthcheckBadGateway creates a HTTPHealthcheckBadGateway with default headers values -func NewHTTPHealthcheckBadGateway() *HTTPHealthcheckBadGateway { - return &HTTPHealthcheckBadGateway{} -} - -/* -HTTPHealthcheckBadGateway describes a response with status code 502, with default header values. - -bad gateway; agent not reachable -*/ -type HTTPHealthcheckBadGateway struct { -} - -// IsSuccess returns true when this http healthcheck bad gateway response has a 2xx status code -func (o *HTTPHealthcheckBadGateway) IsSuccess() bool { - return false -} - -// IsRedirect returns true when this http healthcheck bad gateway response has a 3xx status code -func (o *HTTPHealthcheckBadGateway) IsRedirect() bool { - return false -} - -// IsClientError returns true when this http healthcheck bad gateway response has a 4xx status code -func (o *HTTPHealthcheckBadGateway) IsClientError() bool { - return false -} - -// IsServerError returns true when this http healthcheck bad gateway response has a 5xx status code -func (o *HTTPHealthcheckBadGateway) IsServerError() bool { - return true -} - -// IsCode returns true when this http healthcheck bad gateway response a status code equal to that given -func (o *HTTPHealthcheckBadGateway) IsCode(code int) bool { - return code == 502 -} - -// Code gets the status code for the http healthcheck bad gateway response -func (o *HTTPHealthcheckBadGateway) Code() int { - return 502 -} - -func (o *HTTPHealthcheckBadGateway) Error() string { - return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] httpHealthcheckBadGateway ", 502) -} - -func (o *HTTPHealthcheckBadGateway) String() string { - return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] httpHealthcheckBadGateway ", 502) -} - -func (o *HTTPHealthcheckBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -/* -HTTPHealthcheckBody HTTP healthcheck body -swagger:model HTTPHealthcheckBody -*/ -type HTTPHealthcheckBody struct { - - // endpoint - Endpoint string `json:"endpoint,omitempty"` - - // env z Id - EnvZID string `json:"envZId,omitempty"` - - // expected Http response - ExpectedHTTPResponse float64 `json:"expectedHttpResponse,omitempty"` - - // http verb - HTTPVerb string `json:"httpVerb,omitempty"` - - // share token - ShareToken string `json:"shareToken,omitempty"` - - // timeout ms - TimeoutMs float64 `json:"timeoutMs,omitempty"` -} - -// Validate validates this HTTP healthcheck body -func (o *HTTPHealthcheckBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this HTTP healthcheck body based on context it is used -func (o *HTTPHealthcheckBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *HTTPHealthcheckBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *HTTPHealthcheckBody) UnmarshalBinary(b []byte) error { - var res HTTPHealthcheckBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -/* -HTTPHealthcheckOKBody HTTP healthcheck o k body -swagger:model HTTPHealthcheckOKBody -*/ -type HTTPHealthcheckOKBody struct { - - // error - Error string `json:"error,omitempty"` - - // healthy - Healthy bool `json:"healthy,omitempty"` -} - -// Validate validates this HTTP healthcheck o k body -func (o *HTTPHealthcheckOKBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this HTTP healthcheck o k body based on context it is used -func (o *HTTPHealthcheckOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *HTTPHealthcheckOKBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *HTTPHealthcheckOKBody) UnmarshalBinary(b []byte) error { - var res HTTPHealthcheckOKBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/rest_client_zrok/agent/share_http_healthcheck_parameters.go b/rest_client_zrok/agent/share_http_healthcheck_parameters.go new file mode 100644 index 00000000..9129690a --- /dev/null +++ b/rest_client_zrok/agent/share_http_healthcheck_parameters.go @@ -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" +) + +// NewShareHTTPHealthcheckParams creates a new ShareHTTPHealthcheckParams 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 NewShareHTTPHealthcheckParams() *ShareHTTPHealthcheckParams { + return &ShareHTTPHealthcheckParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewShareHTTPHealthcheckParamsWithTimeout creates a new ShareHTTPHealthcheckParams object +// with the ability to set a timeout on a request. +func NewShareHTTPHealthcheckParamsWithTimeout(timeout time.Duration) *ShareHTTPHealthcheckParams { + return &ShareHTTPHealthcheckParams{ + timeout: timeout, + } +} + +// NewShareHTTPHealthcheckParamsWithContext creates a new ShareHTTPHealthcheckParams object +// with the ability to set a context for a request. +func NewShareHTTPHealthcheckParamsWithContext(ctx context.Context) *ShareHTTPHealthcheckParams { + return &ShareHTTPHealthcheckParams{ + Context: ctx, + } +} + +// NewShareHTTPHealthcheckParamsWithHTTPClient creates a new ShareHTTPHealthcheckParams object +// with the ability to set a custom HTTPClient for a request. +func NewShareHTTPHealthcheckParamsWithHTTPClient(client *http.Client) *ShareHTTPHealthcheckParams { + return &ShareHTTPHealthcheckParams{ + HTTPClient: client, + } +} + +/* +ShareHTTPHealthcheckParams contains all the parameters to send to the API endpoint + + for the share Http healthcheck operation. + + Typically these are written to a http.Request. +*/ +type ShareHTTPHealthcheckParams struct { + + // Body. + Body ShareHTTPHealthcheckBody + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the share Http healthcheck params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ShareHTTPHealthcheckParams) WithDefaults() *ShareHTTPHealthcheckParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the share Http healthcheck params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ShareHTTPHealthcheckParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the share Http healthcheck params +func (o *ShareHTTPHealthcheckParams) WithTimeout(timeout time.Duration) *ShareHTTPHealthcheckParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the share Http healthcheck params +func (o *ShareHTTPHealthcheckParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the share Http healthcheck params +func (o *ShareHTTPHealthcheckParams) WithContext(ctx context.Context) *ShareHTTPHealthcheckParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the share Http healthcheck params +func (o *ShareHTTPHealthcheckParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the share Http healthcheck params +func (o *ShareHTTPHealthcheckParams) WithHTTPClient(client *http.Client) *ShareHTTPHealthcheckParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the share Http healthcheck params +func (o *ShareHTTPHealthcheckParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the share Http healthcheck params +func (o *ShareHTTPHealthcheckParams) WithBody(body ShareHTTPHealthcheckBody) *ShareHTTPHealthcheckParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the share Http healthcheck params +func (o *ShareHTTPHealthcheckParams) SetBody(body ShareHTTPHealthcheckBody) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ShareHTTPHealthcheckParams) 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 +} diff --git a/rest_client_zrok/agent/share_http_healthcheck_responses.go b/rest_client_zrok/agent/share_http_healthcheck_responses.go new file mode 100644 index 00000000..7f1e8289 --- /dev/null +++ b/rest_client_zrok/agent/share_http_healthcheck_responses.go @@ -0,0 +1,383 @@ +// 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" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ShareHTTPHealthcheckReader is a Reader for the ShareHTTPHealthcheck structure. +type ShareHTTPHealthcheckReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ShareHTTPHealthcheckReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewShareHTTPHealthcheckOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewShareHTTPHealthcheckUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewShareHTTPHealthcheckInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 502: + result := NewShareHTTPHealthcheckBadGateway() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /agent/share/http-healthcheck] shareHttpHealthcheck", response, response.Code()) + } +} + +// NewShareHTTPHealthcheckOK creates a ShareHTTPHealthcheckOK with default headers values +func NewShareHTTPHealthcheckOK() *ShareHTTPHealthcheckOK { + return &ShareHTTPHealthcheckOK{} +} + +/* +ShareHTTPHealthcheckOK describes a response with status code 200, with default header values. + +ok +*/ +type ShareHTTPHealthcheckOK struct { + Payload *ShareHTTPHealthcheckOKBody +} + +// IsSuccess returns true when this share Http healthcheck o k response has a 2xx status code +func (o *ShareHTTPHealthcheckOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this share Http healthcheck o k response has a 3xx status code +func (o *ShareHTTPHealthcheckOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this share Http healthcheck o k response has a 4xx status code +func (o *ShareHTTPHealthcheckOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this share Http healthcheck o k response has a 5xx status code +func (o *ShareHTTPHealthcheckOK) IsServerError() bool { + return false +} + +// IsCode returns true when this share Http healthcheck o k response a status code equal to that given +func (o *ShareHTTPHealthcheckOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the share Http healthcheck o k response +func (o *ShareHTTPHealthcheckOK) Code() int { + return 200 +} + +func (o *ShareHTTPHealthcheckOK) Error() string { + return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] shareHttpHealthcheckOK %+v", 200, o.Payload) +} + +func (o *ShareHTTPHealthcheckOK) String() string { + return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] shareHttpHealthcheckOK %+v", 200, o.Payload) +} + +func (o *ShareHTTPHealthcheckOK) GetPayload() *ShareHTTPHealthcheckOKBody { + return o.Payload +} + +func (o *ShareHTTPHealthcheckOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(ShareHTTPHealthcheckOKBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewShareHTTPHealthcheckUnauthorized creates a ShareHTTPHealthcheckUnauthorized with default headers values +func NewShareHTTPHealthcheckUnauthorized() *ShareHTTPHealthcheckUnauthorized { + return &ShareHTTPHealthcheckUnauthorized{} +} + +/* +ShareHTTPHealthcheckUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ShareHTTPHealthcheckUnauthorized struct { +} + +// IsSuccess returns true when this share Http healthcheck unauthorized response has a 2xx status code +func (o *ShareHTTPHealthcheckUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this share Http healthcheck unauthorized response has a 3xx status code +func (o *ShareHTTPHealthcheckUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this share Http healthcheck unauthorized response has a 4xx status code +func (o *ShareHTTPHealthcheckUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this share Http healthcheck unauthorized response has a 5xx status code +func (o *ShareHTTPHealthcheckUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this share Http healthcheck unauthorized response a status code equal to that given +func (o *ShareHTTPHealthcheckUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the share Http healthcheck unauthorized response +func (o *ShareHTTPHealthcheckUnauthorized) Code() int { + return 401 +} + +func (o *ShareHTTPHealthcheckUnauthorized) Error() string { + return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] shareHttpHealthcheckUnauthorized ", 401) +} + +func (o *ShareHTTPHealthcheckUnauthorized) String() string { + return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] shareHttpHealthcheckUnauthorized ", 401) +} + +func (o *ShareHTTPHealthcheckUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewShareHTTPHealthcheckInternalServerError creates a ShareHTTPHealthcheckInternalServerError with default headers values +func NewShareHTTPHealthcheckInternalServerError() *ShareHTTPHealthcheckInternalServerError { + return &ShareHTTPHealthcheckInternalServerError{} +} + +/* +ShareHTTPHealthcheckInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ShareHTTPHealthcheckInternalServerError struct { +} + +// IsSuccess returns true when this share Http healthcheck internal server error response has a 2xx status code +func (o *ShareHTTPHealthcheckInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this share Http healthcheck internal server error response has a 3xx status code +func (o *ShareHTTPHealthcheckInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this share Http healthcheck internal server error response has a 4xx status code +func (o *ShareHTTPHealthcheckInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this share Http healthcheck internal server error response has a 5xx status code +func (o *ShareHTTPHealthcheckInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this share Http healthcheck internal server error response a status code equal to that given +func (o *ShareHTTPHealthcheckInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the share Http healthcheck internal server error response +func (o *ShareHTTPHealthcheckInternalServerError) Code() int { + return 500 +} + +func (o *ShareHTTPHealthcheckInternalServerError) Error() string { + return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] shareHttpHealthcheckInternalServerError ", 500) +} + +func (o *ShareHTTPHealthcheckInternalServerError) String() string { + return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] shareHttpHealthcheckInternalServerError ", 500) +} + +func (o *ShareHTTPHealthcheckInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewShareHTTPHealthcheckBadGateway creates a ShareHTTPHealthcheckBadGateway with default headers values +func NewShareHTTPHealthcheckBadGateway() *ShareHTTPHealthcheckBadGateway { + return &ShareHTTPHealthcheckBadGateway{} +} + +/* +ShareHTTPHealthcheckBadGateway describes a response with status code 502, with default header values. + +bad gateway; agent not reachable +*/ +type ShareHTTPHealthcheckBadGateway struct { +} + +// IsSuccess returns true when this share Http healthcheck bad gateway response has a 2xx status code +func (o *ShareHTTPHealthcheckBadGateway) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this share Http healthcheck bad gateway response has a 3xx status code +func (o *ShareHTTPHealthcheckBadGateway) IsRedirect() bool { + return false +} + +// IsClientError returns true when this share Http healthcheck bad gateway response has a 4xx status code +func (o *ShareHTTPHealthcheckBadGateway) IsClientError() bool { + return false +} + +// IsServerError returns true when this share Http healthcheck bad gateway response has a 5xx status code +func (o *ShareHTTPHealthcheckBadGateway) IsServerError() bool { + return true +} + +// IsCode returns true when this share Http healthcheck bad gateway response a status code equal to that given +func (o *ShareHTTPHealthcheckBadGateway) IsCode(code int) bool { + return code == 502 +} + +// Code gets the status code for the share Http healthcheck bad gateway response +func (o *ShareHTTPHealthcheckBadGateway) Code() int { + return 502 +} + +func (o *ShareHTTPHealthcheckBadGateway) Error() string { + return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] shareHttpHealthcheckBadGateway ", 502) +} + +func (o *ShareHTTPHealthcheckBadGateway) String() string { + return fmt.Sprintf("[POST /agent/share/http-healthcheck][%d] shareHttpHealthcheckBadGateway ", 502) +} + +func (o *ShareHTTPHealthcheckBadGateway) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +/* +ShareHTTPHealthcheckBody share HTTP healthcheck body +swagger:model ShareHTTPHealthcheckBody +*/ +type ShareHTTPHealthcheckBody struct { + + // endpoint + Endpoint string `json:"endpoint,omitempty"` + + // env z Id + EnvZID string `json:"envZId,omitempty"` + + // expected Http response + ExpectedHTTPResponse float64 `json:"expectedHttpResponse,omitempty"` + + // http verb + HTTPVerb string `json:"httpVerb,omitempty"` + + // share token + ShareToken string `json:"shareToken,omitempty"` + + // timeout ms + TimeoutMs float64 `json:"timeoutMs,omitempty"` +} + +// Validate validates this share HTTP healthcheck body +func (o *ShareHTTPHealthcheckBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this share HTTP healthcheck body based on context it is used +func (o *ShareHTTPHealthcheckBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ShareHTTPHealthcheckBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ShareHTTPHealthcheckBody) UnmarshalBinary(b []byte) error { + var res ShareHTTPHealthcheckBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +/* +ShareHTTPHealthcheckOKBody share HTTP healthcheck o k body +swagger:model ShareHTTPHealthcheckOKBody +*/ +type ShareHTTPHealthcheckOKBody struct { + + // error + Error string `json:"error,omitempty"` + + // healthy + Healthy bool `json:"healthy,omitempty"` +} + +// Validate validates this share HTTP healthcheck o k body +func (o *ShareHTTPHealthcheckOKBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this share HTTP healthcheck o k body based on context it is used +func (o *ShareHTTPHealthcheckOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ShareHTTPHealthcheckOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ShareHTTPHealthcheckOKBody) UnmarshalBinary(b []byte) error { + var res ShareHTTPHealthcheckOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/rest_server_zrok/embedded_spec.go b/rest_server_zrok/embedded_spec.go index cc834212..8fcfb171 100644 --- a/rest_server_zrok/embedded_spec.go +++ b/rest_server_zrok/embedded_spec.go @@ -518,7 +518,7 @@ func init() { "tags": [ "agent" ], - "operationId": "httpHealthcheck", + "operationId": "shareHttpHealthcheck", "parameters": [ { "name": "body", @@ -3623,7 +3623,7 @@ func init() { "tags": [ "agent" ], - "operationId": "httpHealthcheck", + "operationId": "shareHttpHealthcheck", "parameters": [ { "name": "body", diff --git a/rest_server_zrok/operations/agent/http_healthcheck.go b/rest_server_zrok/operations/agent/http_healthcheck.go deleted file mode 100644 index 3e0d919a..00000000 --- a/rest_server_zrok/operations/agent/http_healthcheck.go +++ /dev/null @@ -1,166 +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" - - "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - - "github.com/openziti/zrok/rest_model_zrok" -) - -// HTTPHealthcheckHandlerFunc turns a function with the right signature into a http healthcheck handler -type HTTPHealthcheckHandlerFunc func(HTTPHealthcheckParams, *rest_model_zrok.Principal) middleware.Responder - -// Handle executing the request and returning a response -func (fn HTTPHealthcheckHandlerFunc) Handle(params HTTPHealthcheckParams, principal *rest_model_zrok.Principal) middleware.Responder { - return fn(params, principal) -} - -// HTTPHealthcheckHandler interface for that can handle valid http healthcheck params -type HTTPHealthcheckHandler interface { - Handle(HTTPHealthcheckParams, *rest_model_zrok.Principal) middleware.Responder -} - -// NewHTTPHealthcheck creates a new http.Handler for the http healthcheck operation -func NewHTTPHealthcheck(ctx *middleware.Context, handler HTTPHealthcheckHandler) *HTTPHealthcheck { - return &HTTPHealthcheck{Context: ctx, Handler: handler} -} - -/* - HTTPHealthcheck swagger:route POST /agent/share/http-healthcheck agent httpHealthcheck - -HTTPHealthcheck http healthcheck API -*/ -type HTTPHealthcheck struct { - Context *middleware.Context - Handler HTTPHealthcheckHandler -} - -func (o *HTTPHealthcheck) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - *r = *rCtx - } - var Params = NewHTTPHealthcheckParams() - 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) - -} - -// HTTPHealthcheckBody HTTP healthcheck body -// -// swagger:model HTTPHealthcheckBody -type HTTPHealthcheckBody struct { - - // endpoint - Endpoint string `json:"endpoint,omitempty"` - - // env z Id - EnvZID string `json:"envZId,omitempty"` - - // expected Http response - ExpectedHTTPResponse float64 `json:"expectedHttpResponse,omitempty"` - - // http verb - HTTPVerb string `json:"httpVerb,omitempty"` - - // share token - ShareToken string `json:"shareToken,omitempty"` - - // timeout ms - TimeoutMs float64 `json:"timeoutMs,omitempty"` -} - -// Validate validates this HTTP healthcheck body -func (o *HTTPHealthcheckBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this HTTP healthcheck body based on context it is used -func (o *HTTPHealthcheckBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *HTTPHealthcheckBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *HTTPHealthcheckBody) UnmarshalBinary(b []byte) error { - var res HTTPHealthcheckBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} - -// HTTPHealthcheckOKBody HTTP healthcheck o k body -// -// swagger:model HTTPHealthcheckOKBody -type HTTPHealthcheckOKBody struct { - - // error - Error string `json:"error,omitempty"` - - // healthy - Healthy bool `json:"healthy,omitempty"` -} - -// Validate validates this HTTP healthcheck o k body -func (o *HTTPHealthcheckOKBody) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this HTTP healthcheck o k body based on context it is used -func (o *HTTPHealthcheckOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *HTTPHealthcheckOKBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *HTTPHealthcheckOKBody) UnmarshalBinary(b []byte) error { - var res HTTPHealthcheckOKBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/rest_server_zrok/operations/agent/http_healthcheck_responses.go b/rest_server_zrok/operations/agent/http_healthcheck_responses.go deleted file mode 100644 index 4040300a..00000000 --- a/rest_server_zrok/operations/agent/http_healthcheck_responses.go +++ /dev/null @@ -1,132 +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" -) - -// HTTPHealthcheckOKCode is the HTTP code returned for type HTTPHealthcheckOK -const HTTPHealthcheckOKCode int = 200 - -/* -HTTPHealthcheckOK ok - -swagger:response httpHealthcheckOK -*/ -type HTTPHealthcheckOK struct { - - /* - In: Body - */ - Payload *HTTPHealthcheckOKBody `json:"body,omitempty"` -} - -// NewHTTPHealthcheckOK creates HTTPHealthcheckOK with default headers values -func NewHTTPHealthcheckOK() *HTTPHealthcheckOK { - - return &HTTPHealthcheckOK{} -} - -// WithPayload adds the payload to the http healthcheck o k response -func (o *HTTPHealthcheckOK) WithPayload(payload *HTTPHealthcheckOKBody) *HTTPHealthcheckOK { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the http healthcheck o k response -func (o *HTTPHealthcheckOK) SetPayload(payload *HTTPHealthcheckOKBody) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *HTTPHealthcheckOK) 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 - } - } -} - -// HTTPHealthcheckUnauthorizedCode is the HTTP code returned for type HTTPHealthcheckUnauthorized -const HTTPHealthcheckUnauthorizedCode int = 401 - -/* -HTTPHealthcheckUnauthorized unauthorized - -swagger:response httpHealthcheckUnauthorized -*/ -type HTTPHealthcheckUnauthorized struct { -} - -// NewHTTPHealthcheckUnauthorized creates HTTPHealthcheckUnauthorized with default headers values -func NewHTTPHealthcheckUnauthorized() *HTTPHealthcheckUnauthorized { - - return &HTTPHealthcheckUnauthorized{} -} - -// WriteResponse to the client -func (o *HTTPHealthcheckUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(401) -} - -// HTTPHealthcheckInternalServerErrorCode is the HTTP code returned for type HTTPHealthcheckInternalServerError -const HTTPHealthcheckInternalServerErrorCode int = 500 - -/* -HTTPHealthcheckInternalServerError internal server error - -swagger:response httpHealthcheckInternalServerError -*/ -type HTTPHealthcheckInternalServerError struct { -} - -// NewHTTPHealthcheckInternalServerError creates HTTPHealthcheckInternalServerError with default headers values -func NewHTTPHealthcheckInternalServerError() *HTTPHealthcheckInternalServerError { - - return &HTTPHealthcheckInternalServerError{} -} - -// WriteResponse to the client -func (o *HTTPHealthcheckInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(500) -} - -// HTTPHealthcheckBadGatewayCode is the HTTP code returned for type HTTPHealthcheckBadGateway -const HTTPHealthcheckBadGatewayCode int = 502 - -/* -HTTPHealthcheckBadGateway bad gateway; agent not reachable - -swagger:response httpHealthcheckBadGateway -*/ -type HTTPHealthcheckBadGateway struct { -} - -// NewHTTPHealthcheckBadGateway creates HTTPHealthcheckBadGateway with default headers values -func NewHTTPHealthcheckBadGateway() *HTTPHealthcheckBadGateway { - - return &HTTPHealthcheckBadGateway{} -} - -// WriteResponse to the client -func (o *HTTPHealthcheckBadGateway) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(502) -} diff --git a/rest_server_zrok/operations/agent/share_http_healthcheck.go b/rest_server_zrok/operations/agent/share_http_healthcheck.go new file mode 100644 index 00000000..74b9430a --- /dev/null +++ b/rest_server_zrok/operations/agent/share_http_healthcheck.go @@ -0,0 +1,166 @@ +// 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" +) + +// ShareHTTPHealthcheckHandlerFunc turns a function with the right signature into a share Http healthcheck handler +type ShareHTTPHealthcheckHandlerFunc func(ShareHTTPHealthcheckParams, *rest_model_zrok.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn ShareHTTPHealthcheckHandlerFunc) Handle(params ShareHTTPHealthcheckParams, principal *rest_model_zrok.Principal) middleware.Responder { + return fn(params, principal) +} + +// ShareHTTPHealthcheckHandler interface for that can handle valid share Http healthcheck params +type ShareHTTPHealthcheckHandler interface { + Handle(ShareHTTPHealthcheckParams, *rest_model_zrok.Principal) middleware.Responder +} + +// NewShareHTTPHealthcheck creates a new http.Handler for the share Http healthcheck operation +func NewShareHTTPHealthcheck(ctx *middleware.Context, handler ShareHTTPHealthcheckHandler) *ShareHTTPHealthcheck { + return &ShareHTTPHealthcheck{Context: ctx, Handler: handler} +} + +/* + ShareHTTPHealthcheck swagger:route POST /agent/share/http-healthcheck agent shareHttpHealthcheck + +ShareHTTPHealthcheck share Http healthcheck API +*/ +type ShareHTTPHealthcheck struct { + Context *middleware.Context + Handler ShareHTTPHealthcheckHandler +} + +func (o *ShareHTTPHealthcheck) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewShareHTTPHealthcheckParams() + 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) + +} + +// ShareHTTPHealthcheckBody share HTTP healthcheck body +// +// swagger:model ShareHTTPHealthcheckBody +type ShareHTTPHealthcheckBody struct { + + // endpoint + Endpoint string `json:"endpoint,omitempty"` + + // env z Id + EnvZID string `json:"envZId,omitempty"` + + // expected Http response + ExpectedHTTPResponse float64 `json:"expectedHttpResponse,omitempty"` + + // http verb + HTTPVerb string `json:"httpVerb,omitempty"` + + // share token + ShareToken string `json:"shareToken,omitempty"` + + // timeout ms + TimeoutMs float64 `json:"timeoutMs,omitempty"` +} + +// Validate validates this share HTTP healthcheck body +func (o *ShareHTTPHealthcheckBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this share HTTP healthcheck body based on context it is used +func (o *ShareHTTPHealthcheckBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ShareHTTPHealthcheckBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ShareHTTPHealthcheckBody) UnmarshalBinary(b []byte) error { + var res ShareHTTPHealthcheckBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} + +// ShareHTTPHealthcheckOKBody share HTTP healthcheck o k body +// +// swagger:model ShareHTTPHealthcheckOKBody +type ShareHTTPHealthcheckOKBody struct { + + // error + Error string `json:"error,omitempty"` + + // healthy + Healthy bool `json:"healthy,omitempty"` +} + +// Validate validates this share HTTP healthcheck o k body +func (o *ShareHTTPHealthcheckOKBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this share HTTP healthcheck o k body based on context it is used +func (o *ShareHTTPHealthcheckOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ShareHTTPHealthcheckOKBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ShareHTTPHealthcheckOKBody) UnmarshalBinary(b []byte) error { + var res ShareHTTPHealthcheckOKBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/rest_server_zrok/operations/agent/http_healthcheck_parameters.go b/rest_server_zrok/operations/agent/share_http_healthcheck_parameters.go similarity index 71% rename from rest_server_zrok/operations/agent/http_healthcheck_parameters.go rename to rest_server_zrok/operations/agent/share_http_healthcheck_parameters.go index 9c09f1d8..b1b867d2 100644 --- a/rest_server_zrok/operations/agent/http_healthcheck_parameters.go +++ b/rest_server_zrok/operations/agent/share_http_healthcheck_parameters.go @@ -14,19 +14,19 @@ import ( "github.com/go-openapi/validate" ) -// NewHTTPHealthcheckParams creates a new HTTPHealthcheckParams object +// NewShareHTTPHealthcheckParams creates a new ShareHTTPHealthcheckParams object // // There are no default values defined in the spec. -func NewHTTPHealthcheckParams() HTTPHealthcheckParams { +func NewShareHTTPHealthcheckParams() ShareHTTPHealthcheckParams { - return HTTPHealthcheckParams{} + return ShareHTTPHealthcheckParams{} } -// HTTPHealthcheckParams contains all the bound params for the http healthcheck operation +// ShareHTTPHealthcheckParams contains all the bound params for the share Http healthcheck operation // typically these are obtained from a http.Request // -// swagger:parameters httpHealthcheck -type HTTPHealthcheckParams struct { +// swagger:parameters shareHttpHealthcheck +type ShareHTTPHealthcheckParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` @@ -34,21 +34,21 @@ type HTTPHealthcheckParams struct { /* In: body */ - Body HTTPHealthcheckBody + Body ShareHTTPHealthcheckBody } // 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 NewHTTPHealthcheckParams() beforehand. -func (o *HTTPHealthcheckParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { +// To ensure default values, the struct must have been initialized with NewShareHTTPHealthcheckParams() beforehand. +func (o *ShareHTTPHealthcheckParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { var res []error o.HTTPRequest = r if runtime.HasBody(r) { defer r.Body.Close() - var body HTTPHealthcheckBody + var body ShareHTTPHealthcheckBody if err := route.Consumer.Consume(r.Body, &body); err != nil { res = append(res, errors.NewParseError("body", "body", "", err)) } else { diff --git a/rest_server_zrok/operations/agent/share_http_healthcheck_responses.go b/rest_server_zrok/operations/agent/share_http_healthcheck_responses.go new file mode 100644 index 00000000..486b130b --- /dev/null +++ b/rest_server_zrok/operations/agent/share_http_healthcheck_responses.go @@ -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" +) + +// ShareHTTPHealthcheckOKCode is the HTTP code returned for type ShareHTTPHealthcheckOK +const ShareHTTPHealthcheckOKCode int = 200 + +/* +ShareHTTPHealthcheckOK ok + +swagger:response shareHttpHealthcheckOK +*/ +type ShareHTTPHealthcheckOK struct { + + /* + In: Body + */ + Payload *ShareHTTPHealthcheckOKBody `json:"body,omitempty"` +} + +// NewShareHTTPHealthcheckOK creates ShareHTTPHealthcheckOK with default headers values +func NewShareHTTPHealthcheckOK() *ShareHTTPHealthcheckOK { + + return &ShareHTTPHealthcheckOK{} +} + +// WithPayload adds the payload to the share Http healthcheck o k response +func (o *ShareHTTPHealthcheckOK) WithPayload(payload *ShareHTTPHealthcheckOKBody) *ShareHTTPHealthcheckOK { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the share Http healthcheck o k response +func (o *ShareHTTPHealthcheckOK) SetPayload(payload *ShareHTTPHealthcheckOKBody) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *ShareHTTPHealthcheckOK) 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 + } + } +} + +// ShareHTTPHealthcheckUnauthorizedCode is the HTTP code returned for type ShareHTTPHealthcheckUnauthorized +const ShareHTTPHealthcheckUnauthorizedCode int = 401 + +/* +ShareHTTPHealthcheckUnauthorized unauthorized + +swagger:response shareHttpHealthcheckUnauthorized +*/ +type ShareHTTPHealthcheckUnauthorized struct { +} + +// NewShareHTTPHealthcheckUnauthorized creates ShareHTTPHealthcheckUnauthorized with default headers values +func NewShareHTTPHealthcheckUnauthorized() *ShareHTTPHealthcheckUnauthorized { + + return &ShareHTTPHealthcheckUnauthorized{} +} + +// WriteResponse to the client +func (o *ShareHTTPHealthcheckUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(401) +} + +// ShareHTTPHealthcheckInternalServerErrorCode is the HTTP code returned for type ShareHTTPHealthcheckInternalServerError +const ShareHTTPHealthcheckInternalServerErrorCode int = 500 + +/* +ShareHTTPHealthcheckInternalServerError internal server error + +swagger:response shareHttpHealthcheckInternalServerError +*/ +type ShareHTTPHealthcheckInternalServerError struct { +} + +// NewShareHTTPHealthcheckInternalServerError creates ShareHTTPHealthcheckInternalServerError with default headers values +func NewShareHTTPHealthcheckInternalServerError() *ShareHTTPHealthcheckInternalServerError { + + return &ShareHTTPHealthcheckInternalServerError{} +} + +// WriteResponse to the client +func (o *ShareHTTPHealthcheckInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(500) +} + +// ShareHTTPHealthcheckBadGatewayCode is the HTTP code returned for type ShareHTTPHealthcheckBadGateway +const ShareHTTPHealthcheckBadGatewayCode int = 502 + +/* +ShareHTTPHealthcheckBadGateway bad gateway; agent not reachable + +swagger:response shareHttpHealthcheckBadGateway +*/ +type ShareHTTPHealthcheckBadGateway struct { +} + +// NewShareHTTPHealthcheckBadGateway creates ShareHTTPHealthcheckBadGateway with default headers values +func NewShareHTTPHealthcheckBadGateway() *ShareHTTPHealthcheckBadGateway { + + return &ShareHTTPHealthcheckBadGateway{} +} + +// WriteResponse to the client +func (o *ShareHTTPHealthcheckBadGateway) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(502) +} diff --git a/rest_server_zrok/operations/agent/http_healthcheck_urlbuilder.go b/rest_server_zrok/operations/agent/share_http_healthcheck_urlbuilder.go similarity index 67% rename from rest_server_zrok/operations/agent/http_healthcheck_urlbuilder.go rename to rest_server_zrok/operations/agent/share_http_healthcheck_urlbuilder.go index 5601bb72..1563a95f 100644 --- a/rest_server_zrok/operations/agent/http_healthcheck_urlbuilder.go +++ b/rest_server_zrok/operations/agent/share_http_healthcheck_urlbuilder.go @@ -11,15 +11,15 @@ import ( golangswaggerpaths "path" ) -// HTTPHealthcheckURL generates an URL for the http healthcheck operation -type HTTPHealthcheckURL struct { +// ShareHTTPHealthcheckURL generates an URL for the share Http healthcheck operation +type ShareHTTPHealthcheckURL 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 *HTTPHealthcheckURL) WithBasePath(bp string) *HTTPHealthcheckURL { +func (o *ShareHTTPHealthcheckURL) WithBasePath(bp string) *ShareHTTPHealthcheckURL { o.SetBasePath(bp) return o } @@ -27,12 +27,12 @@ func (o *HTTPHealthcheckURL) WithBasePath(bp string) *HTTPHealthcheckURL { // 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 *HTTPHealthcheckURL) SetBasePath(bp string) { +func (o *ShareHTTPHealthcheckURL) SetBasePath(bp string) { o._basePath = bp } // Build a url path and query string -func (o *HTTPHealthcheckURL) Build() (*url.URL, error) { +func (o *ShareHTTPHealthcheckURL) Build() (*url.URL, error) { var _result url.URL var _path = "/agent/share/http-healthcheck" @@ -47,7 +47,7 @@ func (o *HTTPHealthcheckURL) Build() (*url.URL, error) { } // Must is a helper function to panic when the url builder returns an error -func (o *HTTPHealthcheckURL) Must(u *url.URL, err error) *url.URL { +func (o *ShareHTTPHealthcheckURL) Must(u *url.URL, err error) *url.URL { if err != nil { panic(err) } @@ -58,17 +58,17 @@ func (o *HTTPHealthcheckURL) Must(u *url.URL, err error) *url.URL { } // String returns the string representation of the path with query string -func (o *HTTPHealthcheckURL) String() string { +func (o *ShareHTTPHealthcheckURL) String() string { return o.Must(o.Build()).String() } // BuildFull builds a full url with scheme, host, path and query string -func (o *HTTPHealthcheckURL) BuildFull(scheme, host string) (*url.URL, error) { +func (o *ShareHTTPHealthcheckURL) BuildFull(scheme, host string) (*url.URL, error) { if scheme == "" { - return nil, errors.New("scheme is required for a full url on HTTPHealthcheckURL") + return nil, errors.New("scheme is required for a full url on ShareHTTPHealthcheckURL") } if host == "" { - return nil, errors.New("host is required for a full url on HTTPHealthcheckURL") + return nil, errors.New("host is required for a full url on ShareHTTPHealthcheckURL") } base, err := o.Build() @@ -82,6 +82,6 @@ func (o *HTTPHealthcheckURL) BuildFull(scheme, host string) (*url.URL, error) { } // StringFull returns the string representation of a complete url -func (o *HTTPHealthcheckURL) StringFull(scheme, host string) string { +func (o *ShareHTTPHealthcheckURL) StringFull(scheme, host string) string { return o.Must(o.BuildFull(scheme, host)).String() } diff --git a/rest_server_zrok/operations/zrok_api.go b/rest_server_zrok/operations/zrok_api.go index 46043cfa..b28393dc 100644 --- a/rest_server_zrok/operations/zrok_api.go +++ b/rest_server_zrok/operations/zrok_api.go @@ -131,9 +131,6 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI { AdminGrantsHandler: admin.GrantsHandlerFunc(func(params admin.GrantsParams, principal *rest_model_zrok.Principal) middleware.Responder { return middleware.NotImplemented("operation admin.Grants has not yet been implemented") }), - AgentHTTPHealthcheckHandler: agent.HTTPHealthcheckHandlerFunc(func(params agent.HTTPHealthcheckParams, principal *rest_model_zrok.Principal) middleware.Responder { - return middleware.NotImplemented("operation agent.HTTPHealthcheck has not yet been implemented") - }), AccountInviteHandler: account.InviteHandlerFunc(func(params account.InviteParams) middleware.Responder { return middleware.NotImplemented("operation account.Invite has not yet been implemented") }), @@ -203,6 +200,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI { ShareShareHandler: share.ShareHandlerFunc(func(params share.ShareParams, principal *rest_model_zrok.Principal) middleware.Responder { return middleware.NotImplemented("operation share.Share has not yet been implemented") }), + AgentShareHTTPHealthcheckHandler: agent.ShareHTTPHealthcheckHandlerFunc(func(params agent.ShareHTTPHealthcheckParams, principal *rest_model_zrok.Principal) middleware.Responder { + return middleware.NotImplemented("operation agent.ShareHTTPHealthcheck has not yet been implemented") + }), ShareUnaccessHandler: share.UnaccessHandlerFunc(func(params share.UnaccessParams, principal *rest_model_zrok.Principal) middleware.Responder { return middleware.NotImplemented("operation share.Unaccess has not yet been implemented") }), @@ -334,8 +334,6 @@ type ZrokAPI struct { MetadataGetSparklinesHandler metadata.GetSparklinesHandler // AdminGrantsHandler sets the operation handler for the grants operation AdminGrantsHandler admin.GrantsHandler - // AgentHTTPHealthcheckHandler sets the operation handler for the http healthcheck operation - AgentHTTPHealthcheckHandler agent.HTTPHealthcheckHandler // AccountInviteHandler sets the operation handler for the invite operation AccountInviteHandler account.InviteHandler // AdminInviteTokenGenerateHandler sets the operation handler for the invite token generate operation @@ -382,6 +380,8 @@ type ZrokAPI struct { AccountResetPasswordRequestHandler account.ResetPasswordRequestHandler // ShareShareHandler sets the operation handler for the share operation ShareShareHandler share.ShareHandler + // AgentShareHTTPHealthcheckHandler sets the operation handler for the share Http healthcheck operation + AgentShareHTTPHealthcheckHandler agent.ShareHTTPHealthcheckHandler // ShareUnaccessHandler sets the operation handler for the unaccess operation ShareUnaccessHandler share.UnaccessHandler // AgentUnenrollHandler sets the operation handler for the unenroll operation @@ -562,9 +562,6 @@ func (o *ZrokAPI) Validate() error { if o.AdminGrantsHandler == nil { unregistered = append(unregistered, "admin.GrantsHandler") } - if o.AgentHTTPHealthcheckHandler == nil { - unregistered = append(unregistered, "agent.HTTPHealthcheckHandler") - } if o.AccountInviteHandler == nil { unregistered = append(unregistered, "account.InviteHandler") } @@ -634,6 +631,9 @@ func (o *ZrokAPI) Validate() error { if o.ShareShareHandler == nil { unregistered = append(unregistered, "share.ShareHandler") } + if o.AgentShareHTTPHealthcheckHandler == nil { + unregistered = append(unregistered, "agent.ShareHTTPHealthcheckHandler") + } if o.ShareUnaccessHandler == nil { unregistered = append(unregistered, "share.UnaccessHandler") } @@ -871,10 +871,6 @@ func (o *ZrokAPI) initHandlerCache() { if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } - o.handlers["POST"]["/agent/share/http-healthcheck"] = agent.NewHTTPHealthcheck(o.context, o.AgentHTTPHealthcheckHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } o.handlers["POST"]["/invite"] = account.NewInvite(o.context, o.AccountInviteHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) @@ -964,6 +960,10 @@ func (o *ZrokAPI) initHandlerCache() { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/share"] = share.NewShare(o.context, o.ShareShareHandler) + if o.handlers["POST"] == nil { + o.handlers["POST"] = make(map[string]http.Handler) + } + o.handlers["POST"]["/agent/share/http-healthcheck"] = agent.NewShareHTTPHealthcheck(o.context, o.AgentShareHTTPHealthcheckHandler) if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } diff --git a/sdk/nodejs/sdk/src/api/.openapi-generator/FILES b/sdk/nodejs/sdk/src/api/.openapi-generator/FILES index a2a4762f..f9ae5ced 100644 --- a/sdk/nodejs/sdk/src/api/.openapi-generator/FILES +++ b/sdk/nodejs/sdk/src/api/.openapi-generator/FILES @@ -30,8 +30,6 @@ models/EnvironmentAndResources.ts models/Frontend.ts models/GetSparklines200Response.ts models/GetSparklinesRequest.ts -models/HttpHealthcheck200Response.ts -models/HttpHealthcheckRequest.ts models/InviteRequest.ts models/InviteTokenGenerateRequest.ts models/ListFrontends200ResponseInner.ts @@ -64,6 +62,8 @@ models/RemoteUnshareRequest.ts models/RemoveOrganizationMemberRequest.ts models/ResetPasswordRequest.ts models/Share.ts +models/ShareHttpHealthcheck200Response.ts +models/ShareHttpHealthcheckRequest.ts models/ShareRequest.ts models/ShareResponse.ts models/SparkDataSample.ts diff --git a/sdk/nodejs/sdk/src/api/apis/AgentApi.ts b/sdk/nodejs/sdk/src/api/apis/AgentApi.ts index f68092e1..a4de7253 100644 --- a/sdk/nodejs/sdk/src/api/apis/AgentApi.ts +++ b/sdk/nodejs/sdk/src/api/apis/AgentApi.ts @@ -18,8 +18,6 @@ import type { CreateFrontend201Response, Enroll200Response, EnrollRequest, - HttpHealthcheck200Response, - HttpHealthcheckRequest, Ping200Response, RemoteAccessRequest, RemoteShare200Response, @@ -27,6 +25,8 @@ import type { RemoteStatus200Response, RemoteUnaccessRequest, RemoteUnshareRequest, + ShareHttpHealthcheck200Response, + ShareHttpHealthcheckRequest, } from '../models/index'; import { CreateFrontend201ResponseFromJSON, @@ -35,10 +35,6 @@ import { Enroll200ResponseToJSON, EnrollRequestFromJSON, EnrollRequestToJSON, - HttpHealthcheck200ResponseFromJSON, - HttpHealthcheck200ResponseToJSON, - HttpHealthcheckRequestFromJSON, - HttpHealthcheckRequestToJSON, Ping200ResponseFromJSON, Ping200ResponseToJSON, RemoteAccessRequestFromJSON, @@ -53,16 +49,16 @@ import { RemoteUnaccessRequestToJSON, RemoteUnshareRequestFromJSON, RemoteUnshareRequestToJSON, + ShareHttpHealthcheck200ResponseFromJSON, + ShareHttpHealthcheck200ResponseToJSON, + ShareHttpHealthcheckRequestFromJSON, + ShareHttpHealthcheckRequestToJSON, } from '../models/index'; export interface EnrollOperationRequest { body?: EnrollRequest; } -export interface HttpHealthcheckOperationRequest { - body?: HttpHealthcheckRequest; -} - export interface PingRequest { body?: EnrollRequest; } @@ -87,6 +83,10 @@ export interface RemoteUnshareOperationRequest { body?: RemoteUnshareRequest; } +export interface ShareHttpHealthcheckOperationRequest { + body?: ShareHttpHealthcheckRequest; +} + export interface UnenrollRequest { body?: EnrollRequest; } @@ -130,40 +130,6 @@ export class AgentApi extends runtime.BaseAPI { return await response.value(); } - /** - */ - async httpHealthcheckRaw(requestParameters: HttpHealthcheckOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/zrok.v1+json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["x-token"] = await this.configuration.apiKey("x-token"); // key authentication - } - - - let urlPath = `/agent/share/http-healthcheck`; - - const response = await this.request({ - path: urlPath, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: HttpHealthcheckRequestToJSON(requestParameters['body']), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => HttpHealthcheck200ResponseFromJSON(jsonValue)); - } - - /** - */ - async httpHealthcheck(requestParameters: HttpHealthcheckOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.httpHealthcheckRaw(requestParameters, initOverrides); - return await response.value(); - } - /** */ async pingRaw(requestParameters: PingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -366,6 +332,40 @@ export class AgentApi extends runtime.BaseAPI { await this.remoteUnshareRaw(requestParameters, initOverrides); } + /** + */ + async shareHttpHealthcheckRaw(requestParameters: ShareHttpHealthcheckOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/zrok.v1+json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["x-token"] = await this.configuration.apiKey("x-token"); // key authentication + } + + + let urlPath = `/agent/share/http-healthcheck`; + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: ShareHttpHealthcheckRequestToJSON(requestParameters['body']), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ShareHttpHealthcheck200ResponseFromJSON(jsonValue)); + } + + /** + */ + async shareHttpHealthcheck(requestParameters: ShareHttpHealthcheckOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.shareHttpHealthcheckRaw(requestParameters, initOverrides); + return await response.value(); + } + /** */ async unenrollRaw(requestParameters: UnenrollRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { diff --git a/sdk/nodejs/sdk/src/api/models/HttpHealthcheck200Response.ts b/sdk/nodejs/sdk/src/api/models/HttpHealthcheck200Response.ts deleted file mode 100644 index 43483234..00000000 --- a/sdk/nodejs/sdk/src/api/models/HttpHealthcheck200Response.ts +++ /dev/null @@ -1,73 +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 HttpHealthcheck200Response - */ -export interface HttpHealthcheck200Response { - /** - * - * @type {boolean} - * @memberof HttpHealthcheck200Response - */ - healthy?: boolean; - /** - * - * @type {string} - * @memberof HttpHealthcheck200Response - */ - error?: string; -} - -/** - * Check if a given object implements the HttpHealthcheck200Response interface. - */ -export function instanceOfHttpHealthcheck200Response(value: object): value is HttpHealthcheck200Response { - return true; -} - -export function HttpHealthcheck200ResponseFromJSON(json: any): HttpHealthcheck200Response { - return HttpHealthcheck200ResponseFromJSONTyped(json, false); -} - -export function HttpHealthcheck200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HttpHealthcheck200Response { - if (json == null) { - return json; - } - return { - - 'healthy': json['healthy'] == null ? undefined : json['healthy'], - 'error': json['error'] == null ? undefined : json['error'], - }; -} - -export function HttpHealthcheck200ResponseToJSON(json: any): HttpHealthcheck200Response { - return HttpHealthcheck200ResponseToJSONTyped(json, false); -} - -export function HttpHealthcheck200ResponseToJSONTyped(value?: HttpHealthcheck200Response | null, ignoreDiscriminator: boolean = false): any { - if (value == null) { - return value; - } - - return { - - 'healthy': value['healthy'], - 'error': value['error'], - }; -} - diff --git a/sdk/nodejs/sdk/src/api/models/ShareHttpHealthcheck200Response.ts b/sdk/nodejs/sdk/src/api/models/ShareHttpHealthcheck200Response.ts new file mode 100644 index 00000000..511ab0ec --- /dev/null +++ b/sdk/nodejs/sdk/src/api/models/ShareHttpHealthcheck200Response.ts @@ -0,0 +1,73 @@ +/* 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 ShareHttpHealthcheck200Response + */ +export interface ShareHttpHealthcheck200Response { + /** + * + * @type {boolean} + * @memberof ShareHttpHealthcheck200Response + */ + healthy?: boolean; + /** + * + * @type {string} + * @memberof ShareHttpHealthcheck200Response + */ + error?: string; +} + +/** + * Check if a given object implements the ShareHttpHealthcheck200Response interface. + */ +export function instanceOfShareHttpHealthcheck200Response(value: object): value is ShareHttpHealthcheck200Response { + return true; +} + +export function ShareHttpHealthcheck200ResponseFromJSON(json: any): ShareHttpHealthcheck200Response { + return ShareHttpHealthcheck200ResponseFromJSONTyped(json, false); +} + +export function ShareHttpHealthcheck200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ShareHttpHealthcheck200Response { + if (json == null) { + return json; + } + return { + + 'healthy': json['healthy'] == null ? undefined : json['healthy'], + 'error': json['error'] == null ? undefined : json['error'], + }; +} + +export function ShareHttpHealthcheck200ResponseToJSON(json: any): ShareHttpHealthcheck200Response { + return ShareHttpHealthcheck200ResponseToJSONTyped(json, false); +} + +export function ShareHttpHealthcheck200ResponseToJSONTyped(value?: ShareHttpHealthcheck200Response | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'healthy': value['healthy'], + 'error': value['error'], + }; +} + diff --git a/sdk/nodejs/sdk/src/api/models/HttpHealthcheckRequest.ts b/sdk/nodejs/sdk/src/api/models/ShareHttpHealthcheckRequest.ts similarity index 60% rename from sdk/nodejs/sdk/src/api/models/HttpHealthcheckRequest.ts rename to sdk/nodejs/sdk/src/api/models/ShareHttpHealthcheckRequest.ts index dfa12b7e..b0baec66 100644 --- a/sdk/nodejs/sdk/src/api/models/HttpHealthcheckRequest.ts +++ b/sdk/nodejs/sdk/src/api/models/ShareHttpHealthcheckRequest.ts @@ -16,59 +16,59 @@ import { mapValues } from '../runtime'; /** * * @export - * @interface HttpHealthcheckRequest + * @interface ShareHttpHealthcheckRequest */ -export interface HttpHealthcheckRequest { +export interface ShareHttpHealthcheckRequest { /** * * @type {string} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ envZId?: string; /** * * @type {string} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ shareToken?: string; /** * * @type {string} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ httpVerb?: string; /** * * @type {string} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ endpoint?: string; /** * * @type {number} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ expectedHttpResponse?: number; /** * * @type {number} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ timeoutMs?: number; } /** - * Check if a given object implements the HttpHealthcheckRequest interface. + * Check if a given object implements the ShareHttpHealthcheckRequest interface. */ -export function instanceOfHttpHealthcheckRequest(value: object): value is HttpHealthcheckRequest { +export function instanceOfShareHttpHealthcheckRequest(value: object): value is ShareHttpHealthcheckRequest { return true; } -export function HttpHealthcheckRequestFromJSON(json: any): HttpHealthcheckRequest { - return HttpHealthcheckRequestFromJSONTyped(json, false); +export function ShareHttpHealthcheckRequestFromJSON(json: any): ShareHttpHealthcheckRequest { + return ShareHttpHealthcheckRequestFromJSONTyped(json, false); } -export function HttpHealthcheckRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): HttpHealthcheckRequest { +export function ShareHttpHealthcheckRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ShareHttpHealthcheckRequest { if (json == null) { return json; } @@ -83,11 +83,11 @@ export function HttpHealthcheckRequestFromJSONTyped(json: any, ignoreDiscriminat }; } -export function HttpHealthcheckRequestToJSON(json: any): HttpHealthcheckRequest { - return HttpHealthcheckRequestToJSONTyped(json, false); +export function ShareHttpHealthcheckRequestToJSON(json: any): ShareHttpHealthcheckRequest { + return ShareHttpHealthcheckRequestToJSONTyped(json, false); } -export function HttpHealthcheckRequestToJSONTyped(value?: HttpHealthcheckRequest | null, ignoreDiscriminator: boolean = false): any { +export function ShareHttpHealthcheckRequestToJSONTyped(value?: ShareHttpHealthcheckRequest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/sdk/nodejs/sdk/src/api/models/index.ts b/sdk/nodejs/sdk/src/api/models/index.ts index 726eb992..840bbd14 100644 --- a/sdk/nodejs/sdk/src/api/models/index.ts +++ b/sdk/nodejs/sdk/src/api/models/index.ts @@ -23,8 +23,6 @@ export * from './EnvironmentAndResources'; export * from './Frontend'; export * from './GetSparklines200Response'; export * from './GetSparklinesRequest'; -export * from './HttpHealthcheck200Response'; -export * from './HttpHealthcheckRequest'; export * from './InviteRequest'; export * from './InviteTokenGenerateRequest'; export * from './ListFrontends200ResponseInner'; @@ -57,6 +55,8 @@ export * from './RemoteUnshareRequest'; export * from './RemoveOrganizationMemberRequest'; export * from './ResetPasswordRequest'; export * from './Share'; +export * from './ShareHttpHealthcheck200Response'; +export * from './ShareHttpHealthcheckRequest'; export * from './ShareRequest'; export * from './ShareResponse'; export * from './SparkDataSample'; diff --git a/sdk/python/src/.openapi-generator/FILES b/sdk/python/src/.openapi-generator/FILES index 3e69cf8f..e317258f 100644 --- a/sdk/python/src/.openapi-generator/FILES +++ b/sdk/python/src/.openapi-generator/FILES @@ -28,8 +28,6 @@ docs/EnvironmentApi.md docs/Frontend.md docs/GetSparklines200Response.md docs/GetSparklinesRequest.md -docs/HttpHealthcheck200Response.md -docs/HttpHealthcheckRequest.md docs/InviteRequest.md docs/InviteTokenGenerateRequest.md docs/ListFrontends200ResponseInner.md @@ -63,6 +61,8 @@ docs/RemoveOrganizationMemberRequest.md docs/ResetPasswordRequest.md docs/Share.md docs/ShareApi.md +docs/ShareHttpHealthcheck200Response.md +docs/ShareHttpHealthcheckRequest.md docs/ShareRequest.md docs/ShareResponse.md docs/SparkDataSample.md @@ -105,8 +105,6 @@ test/test_environment_api.py test/test_frontend.py test/test_get_sparklines200_response.py test/test_get_sparklines_request.py -test/test_http_healthcheck200_response.py -test/test_http_healthcheck_request.py test/test_invite_request.py test/test_invite_token_generate_request.py test/test_list_frontends200_response_inner.py @@ -140,6 +138,8 @@ test/test_remove_organization_member_request.py test/test_reset_password_request.py test/test_share.py test/test_share_api.py +test/test_share_http_healthcheck200_response.py +test/test_share_http_healthcheck_request.py test/test_share_request.py test/test_share_response.py test/test_spark_data_sample.py @@ -188,8 +188,6 @@ zrok_api/models/environment_and_resources.py zrok_api/models/frontend.py zrok_api/models/get_sparklines200_response.py zrok_api/models/get_sparklines_request.py -zrok_api/models/http_healthcheck200_response.py -zrok_api/models/http_healthcheck_request.py zrok_api/models/invite_request.py zrok_api/models/invite_token_generate_request.py zrok_api/models/list_frontends200_response_inner.py @@ -221,6 +219,8 @@ zrok_api/models/remote_unshare_request.py zrok_api/models/remove_organization_member_request.py zrok_api/models/reset_password_request.py zrok_api/models/share.py +zrok_api/models/share_http_healthcheck200_response.py +zrok_api/models/share_http_healthcheck_request.py zrok_api/models/share_request.py zrok_api/models/share_response.py zrok_api/models/spark_data_sample.py diff --git a/sdk/python/src/README.md b/sdk/python/src/README.md index 78bb8c87..dabbb2d7 100644 --- a/sdk/python/src/README.md +++ b/sdk/python/src/README.md @@ -119,13 +119,13 @@ Class | Method | HTTP request | Description *AdminApi* | [**remove_organization_member**](docs/AdminApi.md#remove_organization_member) | **POST** /organization/remove | *AdminApi* | [**update_frontend**](docs/AdminApi.md#update_frontend) | **PATCH** /frontend | *AgentApi* | [**enroll**](docs/AgentApi.md#enroll) | **POST** /agent/enroll | -*AgentApi* | [**http_healthcheck**](docs/AgentApi.md#http_healthcheck) | **POST** /agent/share/http-healthcheck | *AgentApi* | [**ping**](docs/AgentApi.md#ping) | **POST** /agent/ping | *AgentApi* | [**remote_access**](docs/AgentApi.md#remote_access) | **POST** /agent/access | *AgentApi* | [**remote_share**](docs/AgentApi.md#remote_share) | **POST** /agent/share | *AgentApi* | [**remote_status**](docs/AgentApi.md#remote_status) | **POST** /agent/status | *AgentApi* | [**remote_unaccess**](docs/AgentApi.md#remote_unaccess) | **POST** /agent/unaccess | *AgentApi* | [**remote_unshare**](docs/AgentApi.md#remote_unshare) | **POST** /agent/unshare | +*AgentApi* | [**share_http_healthcheck**](docs/AgentApi.md#share_http_healthcheck) | **POST** /agent/share/http-healthcheck | *AgentApi* | [**unenroll**](docs/AgentApi.md#unenroll) | **POST** /agent/unenroll | *EnvironmentApi* | [**disable**](docs/EnvironmentApi.md#disable) | **POST** /disable | *EnvironmentApi* | [**enable**](docs/EnvironmentApi.md#enable) | **POST** /enable | @@ -180,8 +180,6 @@ Class | Method | HTTP request | Description - [Frontend](docs/Frontend.md) - [GetSparklines200Response](docs/GetSparklines200Response.md) - [GetSparklinesRequest](docs/GetSparklinesRequest.md) - - [HttpHealthcheck200Response](docs/HttpHealthcheck200Response.md) - - [HttpHealthcheckRequest](docs/HttpHealthcheckRequest.md) - [InviteRequest](docs/InviteRequest.md) - [InviteTokenGenerateRequest](docs/InviteTokenGenerateRequest.md) - [ListFrontends200ResponseInner](docs/ListFrontends200ResponseInner.md) @@ -213,6 +211,8 @@ Class | Method | HTTP request | Description - [RemoveOrganizationMemberRequest](docs/RemoveOrganizationMemberRequest.md) - [ResetPasswordRequest](docs/ResetPasswordRequest.md) - [Share](docs/Share.md) + - [ShareHttpHealthcheck200Response](docs/ShareHttpHealthcheck200Response.md) + - [ShareHttpHealthcheckRequest](docs/ShareHttpHealthcheckRequest.md) - [ShareRequest](docs/ShareRequest.md) - [ShareResponse](docs/ShareResponse.md) - [SparkDataSample](docs/SparkDataSample.md) diff --git a/sdk/python/src/docs/AgentApi.md b/sdk/python/src/docs/AgentApi.md index 88d25659..95900af2 100644 --- a/sdk/python/src/docs/AgentApi.md +++ b/sdk/python/src/docs/AgentApi.md @@ -5,13 +5,13 @@ All URIs are relative to */api/v1* Method | HTTP request | Description ------------- | ------------- | ------------- [**enroll**](AgentApi.md#enroll) | **POST** /agent/enroll | -[**http_healthcheck**](AgentApi.md#http_healthcheck) | **POST** /agent/share/http-healthcheck | [**ping**](AgentApi.md#ping) | **POST** /agent/ping | [**remote_access**](AgentApi.md#remote_access) | **POST** /agent/access | [**remote_share**](AgentApi.md#remote_share) | **POST** /agent/share | [**remote_status**](AgentApi.md#remote_status) | **POST** /agent/status | [**remote_unaccess**](AgentApi.md#remote_unaccess) | **POST** /agent/unaccess | [**remote_unshare**](AgentApi.md#remote_unshare) | **POST** /agent/unshare | +[**share_http_healthcheck**](AgentApi.md#share_http_healthcheck) | **POST** /agent/share/http-healthcheck | [**unenroll**](AgentApi.md#unenroll) | **POST** /agent/unenroll | @@ -93,84 +93,6 @@ Name | Type | Description | Notes [[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) -# **http_healthcheck** -> HttpHealthcheck200Response http_healthcheck(body=body) - -### Example - -* Api Key Authentication (key): - -```python -import zrok_api -from zrok_api.models.http_healthcheck200_response import HttpHealthcheck200Response -from zrok_api.models.http_healthcheck_request import HttpHealthcheckRequest -from zrok_api.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to /api/v1 -# See configuration.py for a list of all supported configuration parameters. -configuration = zrok_api.Configuration( - host = "/api/v1" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure API key authorization: key -configuration.api_key['key'] = os.environ["API_KEY"] - -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['key'] = 'Bearer' - -# Enter a context with an instance of the API client -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.HttpHealthcheckRequest() # HttpHealthcheckRequest | (optional) - - try: - api_response = api_instance.http_healthcheck(body=body) - print("The response of AgentApi->http_healthcheck:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling AgentApi->http_healthcheck: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**HttpHealthcheckRequest**](HttpHealthcheckRequest.md)| | [optional] - -### Return type - -[**HttpHealthcheck200Response**](HttpHealthcheck200Response.md) - -### Authorization - -[key](../README.md#key) - -### HTTP request headers - - - **Content-Type**: application/zrok.v1+json - - **Accept**: application/zrok.v1+json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**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) - # **ping** > Ping200Response ping(body=body) @@ -633,6 +555,84 @@ void (empty response body) [[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) +# **share_http_healthcheck** +> ShareHttpHealthcheck200Response share_http_healthcheck(body=body) + +### Example + +* Api Key Authentication (key): + +```python +import zrok_api +from zrok_api.models.share_http_healthcheck200_response import ShareHttpHealthcheck200Response +from zrok_api.models.share_http_healthcheck_request import ShareHttpHealthcheckRequest +from zrok_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to /api/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = zrok_api.Configuration( + host = "/api/v1" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: key +configuration.api_key['key'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['key'] = 'Bearer' + +# Enter a context with an instance of the API client +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.ShareHttpHealthcheckRequest() # ShareHttpHealthcheckRequest | (optional) + + try: + api_response = api_instance.share_http_healthcheck(body=body) + print("The response of AgentApi->share_http_healthcheck:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AgentApi->share_http_healthcheck: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ShareHttpHealthcheckRequest**](ShareHttpHealthcheckRequest.md)| | [optional] + +### Return type + +[**ShareHttpHealthcheck200Response**](ShareHttpHealthcheck200Response.md) + +### Authorization + +[key](../README.md#key) + +### HTTP request headers + + - **Content-Type**: application/zrok.v1+json + - **Accept**: application/zrok.v1+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**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) + # **unenroll** > unenroll(body=body) diff --git a/sdk/python/src/docs/HttpHealthcheck200Response.md b/sdk/python/src/docs/HttpHealthcheck200Response.md deleted file mode 100644 index 61daf5ce..00000000 --- a/sdk/python/src/docs/HttpHealthcheck200Response.md +++ /dev/null @@ -1,30 +0,0 @@ -# HttpHealthcheck200Response - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**healthy** | **bool** | | [optional] -**error** | **str** | | [optional] - -## Example - -```python -from zrok_api.models.http_healthcheck200_response import HttpHealthcheck200Response - -# TODO update the JSON string below -json = "{}" -# create an instance of HttpHealthcheck200Response from a JSON string -http_healthcheck200_response_instance = HttpHealthcheck200Response.from_json(json) -# print the JSON string representation of the object -print(HttpHealthcheck200Response.to_json()) - -# convert the object into a dict -http_healthcheck200_response_dict = http_healthcheck200_response_instance.to_dict() -# create an instance of HttpHealthcheck200Response from a dict -http_healthcheck200_response_from_dict = HttpHealthcheck200Response.from_dict(http_healthcheck200_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) - - diff --git a/sdk/python/src/docs/ShareHttpHealthcheck200Response.md b/sdk/python/src/docs/ShareHttpHealthcheck200Response.md new file mode 100644 index 00000000..982eecdf --- /dev/null +++ b/sdk/python/src/docs/ShareHttpHealthcheck200Response.md @@ -0,0 +1,30 @@ +# ShareHttpHealthcheck200Response + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**healthy** | **bool** | | [optional] +**error** | **str** | | [optional] + +## Example + +```python +from zrok_api.models.share_http_healthcheck200_response import ShareHttpHealthcheck200Response + +# TODO update the JSON string below +json = "{}" +# create an instance of ShareHttpHealthcheck200Response from a JSON string +share_http_healthcheck200_response_instance = ShareHttpHealthcheck200Response.from_json(json) +# print the JSON string representation of the object +print(ShareHttpHealthcheck200Response.to_json()) + +# convert the object into a dict +share_http_healthcheck200_response_dict = share_http_healthcheck200_response_instance.to_dict() +# create an instance of ShareHttpHealthcheck200Response from a dict +share_http_healthcheck200_response_from_dict = ShareHttpHealthcheck200Response.from_dict(share_http_healthcheck200_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) + + diff --git a/sdk/python/src/docs/HttpHealthcheckRequest.md b/sdk/python/src/docs/ShareHttpHealthcheckRequest.md similarity index 54% rename from sdk/python/src/docs/HttpHealthcheckRequest.md rename to sdk/python/src/docs/ShareHttpHealthcheckRequest.md index b084d699..2ed011cd 100644 --- a/sdk/python/src/docs/HttpHealthcheckRequest.md +++ b/sdk/python/src/docs/ShareHttpHealthcheckRequest.md @@ -1,4 +1,4 @@ -# HttpHealthcheckRequest +# ShareHttpHealthcheckRequest ## Properties @@ -15,19 +15,19 @@ Name | Type | Description | Notes ## Example ```python -from zrok_api.models.http_healthcheck_request import HttpHealthcheckRequest +from zrok_api.models.share_http_healthcheck_request import ShareHttpHealthcheckRequest # TODO update the JSON string below json = "{}" -# create an instance of HttpHealthcheckRequest from a JSON string -http_healthcheck_request_instance = HttpHealthcheckRequest.from_json(json) +# create an instance of ShareHttpHealthcheckRequest from a JSON string +share_http_healthcheck_request_instance = ShareHttpHealthcheckRequest.from_json(json) # print the JSON string representation of the object -print(HttpHealthcheckRequest.to_json()) +print(ShareHttpHealthcheckRequest.to_json()) # convert the object into a dict -http_healthcheck_request_dict = http_healthcheck_request_instance.to_dict() -# create an instance of HttpHealthcheckRequest from a dict -http_healthcheck_request_from_dict = HttpHealthcheckRequest.from_dict(http_healthcheck_request_dict) +share_http_healthcheck_request_dict = share_http_healthcheck_request_instance.to_dict() +# create an instance of ShareHttpHealthcheckRequest from a dict +share_http_healthcheck_request_from_dict = ShareHttpHealthcheckRequest.from_dict(share_http_healthcheck_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) diff --git a/sdk/python/src/test/test_agent_api.py b/sdk/python/src/test/test_agent_api.py index e6e82e89..23b6b204 100644 --- a/sdk/python/src/test/test_agent_api.py +++ b/sdk/python/src/test/test_agent_api.py @@ -32,12 +32,6 @@ class TestAgentApi(unittest.TestCase): """ pass - def test_http_healthcheck(self) -> None: - """Test case for http_healthcheck - - """ - pass - def test_ping(self) -> None: """Test case for ping @@ -74,6 +68,12 @@ class TestAgentApi(unittest.TestCase): """ pass + def test_share_http_healthcheck(self) -> None: + """Test case for share_http_healthcheck + + """ + pass + def test_unenroll(self) -> None: """Test case for unenroll diff --git a/sdk/python/src/test/test_http_healthcheck200_response.py b/sdk/python/src/test/test_share_http_healthcheck200_response.py similarity index 54% rename from sdk/python/src/test/test_http_healthcheck200_response.py rename to sdk/python/src/test/test_share_http_healthcheck200_response.py index a2fe32ec..a6df84f8 100644 --- a/sdk/python/src/test/test_http_healthcheck200_response.py +++ b/sdk/python/src/test/test_share_http_healthcheck200_response.py @@ -14,10 +14,10 @@ import unittest -from zrok_api.models.http_healthcheck200_response import HttpHealthcheck200Response +from zrok_api.models.share_http_healthcheck200_response import ShareHttpHealthcheck200Response -class TestHttpHealthcheck200Response(unittest.TestCase): - """HttpHealthcheck200Response unit test stubs""" +class TestShareHttpHealthcheck200Response(unittest.TestCase): + """ShareHttpHealthcheck200Response unit test stubs""" def setUp(self): pass @@ -25,26 +25,26 @@ class TestHttpHealthcheck200Response(unittest.TestCase): def tearDown(self): pass - def make_instance(self, include_optional) -> HttpHealthcheck200Response: - """Test HttpHealthcheck200Response + def make_instance(self, include_optional) -> ShareHttpHealthcheck200Response: + """Test ShareHttpHealthcheck200Response 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 `HttpHealthcheck200Response` + # uncomment below to create an instance of `ShareHttpHealthcheck200Response` """ - model = HttpHealthcheck200Response() + model = ShareHttpHealthcheck200Response() if include_optional: - return HttpHealthcheck200Response( + return ShareHttpHealthcheck200Response( healthy = True, error = '' ) else: - return HttpHealthcheck200Response( + return ShareHttpHealthcheck200Response( ) """ - def testHttpHealthcheck200Response(self): - """Test HttpHealthcheck200Response""" + def testShareHttpHealthcheck200Response(self): + """Test ShareHttpHealthcheck200Response""" # inst_req_only = self.make_instance(include_optional=False) # inst_req_and_optional = self.make_instance(include_optional=True) diff --git a/sdk/python/src/test/test_http_healthcheck_request.py b/sdk/python/src/test/test_share_http_healthcheck_request.py similarity index 60% rename from sdk/python/src/test/test_http_healthcheck_request.py rename to sdk/python/src/test/test_share_http_healthcheck_request.py index 336f5f97..30ea6c67 100644 --- a/sdk/python/src/test/test_http_healthcheck_request.py +++ b/sdk/python/src/test/test_share_http_healthcheck_request.py @@ -14,10 +14,10 @@ import unittest -from zrok_api.models.http_healthcheck_request import HttpHealthcheckRequest +from zrok_api.models.share_http_healthcheck_request import ShareHttpHealthcheckRequest -class TestHttpHealthcheckRequest(unittest.TestCase): - """HttpHealthcheckRequest unit test stubs""" +class TestShareHttpHealthcheckRequest(unittest.TestCase): + """ShareHttpHealthcheckRequest unit test stubs""" def setUp(self): pass @@ -25,16 +25,16 @@ class TestHttpHealthcheckRequest(unittest.TestCase): def tearDown(self): pass - def make_instance(self, include_optional) -> HttpHealthcheckRequest: - """Test HttpHealthcheckRequest + def make_instance(self, include_optional) -> ShareHttpHealthcheckRequest: + """Test ShareHttpHealthcheckRequest 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 `HttpHealthcheckRequest` + # uncomment below to create an instance of `ShareHttpHealthcheckRequest` """ - model = HttpHealthcheckRequest() + model = ShareHttpHealthcheckRequest() if include_optional: - return HttpHealthcheckRequest( + return ShareHttpHealthcheckRequest( env_zid = '', share_token = '', http_verb = '', @@ -43,12 +43,12 @@ class TestHttpHealthcheckRequest(unittest.TestCase): timeout_ms = 1.337 ) else: - return HttpHealthcheckRequest( + return ShareHttpHealthcheckRequest( ) """ - def testHttpHealthcheckRequest(self): - """Test HttpHealthcheckRequest""" + def testShareHttpHealthcheckRequest(self): + """Test ShareHttpHealthcheckRequest""" # inst_req_only = self.make_instance(include_optional=False) # inst_req_and_optional = self.make_instance(include_optional=True) diff --git a/sdk/python/src/zrok_api/__init__.py b/sdk/python/src/zrok_api/__init__.py index 7c8b3313..3e6b1bc8 100644 --- a/sdk/python/src/zrok_api/__init__.py +++ b/sdk/python/src/zrok_api/__init__.py @@ -57,8 +57,6 @@ __all__ = [ "Frontend", "GetSparklines200Response", "GetSparklinesRequest", - "HttpHealthcheck200Response", - "HttpHealthcheckRequest", "InviteRequest", "InviteTokenGenerateRequest", "ListFrontends200ResponseInner", @@ -90,6 +88,8 @@ __all__ = [ "RemoveOrganizationMemberRequest", "ResetPasswordRequest", "Share", + "ShareHttpHealthcheck200Response", + "ShareHttpHealthcheckRequest", "ShareRequest", "ShareResponse", "SparkDataSample", @@ -147,8 +147,6 @@ from zrok_api.models.environment_and_resources import EnvironmentAndResources as from zrok_api.models.frontend import Frontend as Frontend from zrok_api.models.get_sparklines200_response import GetSparklines200Response as GetSparklines200Response from zrok_api.models.get_sparklines_request import GetSparklinesRequest as GetSparklinesRequest -from zrok_api.models.http_healthcheck200_response import HttpHealthcheck200Response as HttpHealthcheck200Response -from zrok_api.models.http_healthcheck_request import HttpHealthcheckRequest as HttpHealthcheckRequest from zrok_api.models.invite_request import InviteRequest as InviteRequest from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest as InviteTokenGenerateRequest from zrok_api.models.list_frontends200_response_inner import ListFrontends200ResponseInner as ListFrontends200ResponseInner @@ -180,6 +178,8 @@ from zrok_api.models.remote_unshare_request import RemoteUnshareRequest as Remot from zrok_api.models.remove_organization_member_request import RemoveOrganizationMemberRequest as RemoveOrganizationMemberRequest from zrok_api.models.reset_password_request import ResetPasswordRequest as ResetPasswordRequest from zrok_api.models.share import Share as Share +from zrok_api.models.share_http_healthcheck200_response import ShareHttpHealthcheck200Response as ShareHttpHealthcheck200Response +from zrok_api.models.share_http_healthcheck_request import ShareHttpHealthcheckRequest as ShareHttpHealthcheckRequest from zrok_api.models.share_request import ShareRequest as ShareRequest from zrok_api.models.share_response import ShareResponse as ShareResponse from zrok_api.models.spark_data_sample import SparkDataSample as SparkDataSample diff --git a/sdk/python/src/zrok_api/api/agent_api.py b/sdk/python/src/zrok_api/api/agent_api.py index 3d41fb3a..6b7598d3 100644 --- a/sdk/python/src/zrok_api/api/agent_api.py +++ b/sdk/python/src/zrok_api/api/agent_api.py @@ -20,8 +20,6 @@ from typing import Optional from zrok_api.models.create_frontend201_response import CreateFrontend201Response from zrok_api.models.enroll200_response import Enroll200Response from zrok_api.models.enroll_request import EnrollRequest -from zrok_api.models.http_healthcheck200_response import HttpHealthcheck200Response -from zrok_api.models.http_healthcheck_request import HttpHealthcheckRequest from zrok_api.models.ping200_response import Ping200Response from zrok_api.models.remote_access_request import RemoteAccessRequest from zrok_api.models.remote_share200_response import RemoteShare200Response @@ -29,6 +27,8 @@ from zrok_api.models.remote_share_request import RemoteShareRequest from zrok_api.models.remote_status200_response import RemoteStatus200Response from zrok_api.models.remote_unaccess_request import RemoteUnaccessRequest from zrok_api.models.remote_unshare_request import RemoteUnshareRequest +from zrok_api.models.share_http_healthcheck200_response import ShareHttpHealthcheck200Response +from zrok_api.models.share_http_healthcheck_request import ShareHttpHealthcheckRequest from zrok_api.api_client import ApiClient, RequestSerialized from zrok_api.api_response import ApiResponse @@ -328,286 +328,6 @@ class AgentApi: - @validate_call - def http_healthcheck( - self, - body: Optional[HttpHealthcheckRequest] = None, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> HttpHealthcheck200Response: - """http_healthcheck - - - :param body: - :type body: HttpHealthcheckRequest - :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 - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._http_healthcheck_serialize( - body=body, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "HttpHealthcheck200Response", - '401': None, - '500': None, - '502': None, - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - def http_healthcheck_with_http_info( - self, - body: Optional[HttpHealthcheckRequest] = None, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[HttpHealthcheck200Response]: - """http_healthcheck - - - :param body: - :type body: HttpHealthcheckRequest - :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 - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._http_healthcheck_serialize( - body=body, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "HttpHealthcheck200Response", - '401': None, - '500': None, - '502': None, - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - def http_healthcheck_without_preload_content( - self, - body: Optional[HttpHealthcheckRequest] = None, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """http_healthcheck - - - :param body: - :type body: HttpHealthcheckRequest - :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 - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._http_healthcheck_serialize( - body=body, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "HttpHealthcheck200Response", - '401': None, - '500': None, - '502': None, - } - response_data = self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _http_healthcheck_serialize( - self, - body, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[ - str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] - ] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if body is not None: - _body_params = body - - - # set the HTTP header `Accept` - if 'Accept' not in _header_params: - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/zrok.v1+json' - ] - ) - - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/zrok.v1+json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type - - # authentication setting - _auth_settings: List[str] = [ - 'key' - ] - - return self.api_client.param_serialize( - method='POST', - resource_path='/agent/share/http-healthcheck', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - @validate_call def ping( self, @@ -2274,6 +1994,286 @@ class AgentApi: + @validate_call + def share_http_healthcheck( + self, + body: Optional[ShareHttpHealthcheckRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ShareHttpHealthcheck200Response: + """share_http_healthcheck + + + :param body: + :type body: ShareHttpHealthcheckRequest + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._share_http_healthcheck_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ShareHttpHealthcheck200Response", + '401': None, + '500': None, + '502': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def share_http_healthcheck_with_http_info( + self, + body: Optional[ShareHttpHealthcheckRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ShareHttpHealthcheck200Response]: + """share_http_healthcheck + + + :param body: + :type body: ShareHttpHealthcheckRequest + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._share_http_healthcheck_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ShareHttpHealthcheck200Response", + '401': None, + '500': None, + '502': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def share_http_healthcheck_without_preload_content( + self, + body: Optional[ShareHttpHealthcheckRequest] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """share_http_healthcheck + + + :param body: + :type body: ShareHttpHealthcheckRequest + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._share_http_healthcheck_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ShareHttpHealthcheck200Response", + '401': None, + '500': None, + '502': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _share_http_healthcheck_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/zrok.v1+json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/zrok.v1+json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'key' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/agent/share/http-healthcheck', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def unenroll( self, diff --git a/sdk/python/src/zrok_api/models/__init__.py b/sdk/python/src/zrok_api/models/__init__.py index 69c55766..5ef55bca 100644 --- a/sdk/python/src/zrok_api/models/__init__.py +++ b/sdk/python/src/zrok_api/models/__init__.py @@ -38,8 +38,6 @@ from zrok_api.models.environment_and_resources import EnvironmentAndResources from zrok_api.models.frontend import Frontend from zrok_api.models.get_sparklines200_response import GetSparklines200Response from zrok_api.models.get_sparklines_request import GetSparklinesRequest -from zrok_api.models.http_healthcheck200_response import HttpHealthcheck200Response -from zrok_api.models.http_healthcheck_request import HttpHealthcheckRequest from zrok_api.models.invite_request import InviteRequest from zrok_api.models.invite_token_generate_request import InviteTokenGenerateRequest from zrok_api.models.list_frontends200_response_inner import ListFrontends200ResponseInner @@ -71,6 +69,8 @@ from zrok_api.models.remote_unshare_request import RemoteUnshareRequest from zrok_api.models.remove_organization_member_request import RemoveOrganizationMemberRequest from zrok_api.models.reset_password_request import ResetPasswordRequest from zrok_api.models.share import Share +from zrok_api.models.share_http_healthcheck200_response import ShareHttpHealthcheck200Response +from zrok_api.models.share_http_healthcheck_request import ShareHttpHealthcheckRequest from zrok_api.models.share_request import ShareRequest from zrok_api.models.share_response import ShareResponse from zrok_api.models.spark_data_sample import SparkDataSample diff --git a/sdk/python/src/zrok_api/models/http_healthcheck200_response.py b/sdk/python/src/zrok_api/models/share_http_healthcheck200_response.py similarity index 90% rename from sdk/python/src/zrok_api/models/http_healthcheck200_response.py rename to sdk/python/src/zrok_api/models/share_http_healthcheck200_response.py index 43ab1c96..86a4f92e 100644 --- a/sdk/python/src/zrok_api/models/http_healthcheck200_response.py +++ b/sdk/python/src/zrok_api/models/share_http_healthcheck200_response.py @@ -22,9 +22,9 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self -class HttpHealthcheck200Response(BaseModel): +class ShareHttpHealthcheck200Response(BaseModel): """ - HttpHealthcheck200Response + ShareHttpHealthcheck200Response """ # noqa: E501 healthy: Optional[StrictBool] = None error: Optional[StrictStr] = None @@ -48,7 +48,7 @@ class HttpHealthcheck200Response(BaseModel): @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of HttpHealthcheck200Response from a JSON string""" + """Create an instance of ShareHttpHealthcheck200Response from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,7 +73,7 @@ class HttpHealthcheck200Response(BaseModel): @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of HttpHealthcheck200Response from a dict""" + """Create an instance of ShareHttpHealthcheck200Response from a dict""" if obj is None: return None diff --git a/sdk/python/src/zrok_api/models/http_healthcheck_request.py b/sdk/python/src/zrok_api/models/share_http_healthcheck_request.py similarity index 92% rename from sdk/python/src/zrok_api/models/http_healthcheck_request.py rename to sdk/python/src/zrok_api/models/share_http_healthcheck_request.py index 6891c6a7..4e6f5842 100644 --- a/sdk/python/src/zrok_api/models/http_healthcheck_request.py +++ b/sdk/python/src/zrok_api/models/share_http_healthcheck_request.py @@ -22,9 +22,9 @@ from typing import Any, ClassVar, Dict, List, Optional, Union from typing import Optional, Set from typing_extensions import Self -class HttpHealthcheckRequest(BaseModel): +class ShareHttpHealthcheckRequest(BaseModel): """ - HttpHealthcheckRequest + ShareHttpHealthcheckRequest """ # noqa: E501 env_zid: Optional[StrictStr] = Field(default=None, alias="envZId") share_token: Optional[StrictStr] = Field(default=None, alias="shareToken") @@ -52,7 +52,7 @@ class HttpHealthcheckRequest(BaseModel): @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of HttpHealthcheckRequest from a JSON string""" + """Create an instance of ShareHttpHealthcheckRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -77,7 +77,7 @@ class HttpHealthcheckRequest(BaseModel): @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of HttpHealthcheckRequest from a dict""" + """Create an instance of ShareHttpHealthcheckRequest from a dict""" if obj is None: return None diff --git a/specs/zrok.yml b/specs/zrok.yml index 9bbfa11c..7566b4ff 100644 --- a/specs/zrok.yml +++ b/specs/zrok.yml @@ -892,7 +892,7 @@ paths: - agent security: - key: [] - operationId: httpHealthcheck + operationId: shareHttpHealthcheck parameters: - name: body in: body diff --git a/ui/src/api/.openapi-generator/FILES b/ui/src/api/.openapi-generator/FILES index a2a4762f..f9ae5ced 100644 --- a/ui/src/api/.openapi-generator/FILES +++ b/ui/src/api/.openapi-generator/FILES @@ -30,8 +30,6 @@ models/EnvironmentAndResources.ts models/Frontend.ts models/GetSparklines200Response.ts models/GetSparklinesRequest.ts -models/HttpHealthcheck200Response.ts -models/HttpHealthcheckRequest.ts models/InviteRequest.ts models/InviteTokenGenerateRequest.ts models/ListFrontends200ResponseInner.ts @@ -64,6 +62,8 @@ models/RemoteUnshareRequest.ts models/RemoveOrganizationMemberRequest.ts models/ResetPasswordRequest.ts models/Share.ts +models/ShareHttpHealthcheck200Response.ts +models/ShareHttpHealthcheckRequest.ts models/ShareRequest.ts models/ShareResponse.ts models/SparkDataSample.ts diff --git a/ui/src/api/apis/AgentApi.ts b/ui/src/api/apis/AgentApi.ts index f68092e1..a4de7253 100644 --- a/ui/src/api/apis/AgentApi.ts +++ b/ui/src/api/apis/AgentApi.ts @@ -18,8 +18,6 @@ import type { CreateFrontend201Response, Enroll200Response, EnrollRequest, - HttpHealthcheck200Response, - HttpHealthcheckRequest, Ping200Response, RemoteAccessRequest, RemoteShare200Response, @@ -27,6 +25,8 @@ import type { RemoteStatus200Response, RemoteUnaccessRequest, RemoteUnshareRequest, + ShareHttpHealthcheck200Response, + ShareHttpHealthcheckRequest, } from '../models/index'; import { CreateFrontend201ResponseFromJSON, @@ -35,10 +35,6 @@ import { Enroll200ResponseToJSON, EnrollRequestFromJSON, EnrollRequestToJSON, - HttpHealthcheck200ResponseFromJSON, - HttpHealthcheck200ResponseToJSON, - HttpHealthcheckRequestFromJSON, - HttpHealthcheckRequestToJSON, Ping200ResponseFromJSON, Ping200ResponseToJSON, RemoteAccessRequestFromJSON, @@ -53,16 +49,16 @@ import { RemoteUnaccessRequestToJSON, RemoteUnshareRequestFromJSON, RemoteUnshareRequestToJSON, + ShareHttpHealthcheck200ResponseFromJSON, + ShareHttpHealthcheck200ResponseToJSON, + ShareHttpHealthcheckRequestFromJSON, + ShareHttpHealthcheckRequestToJSON, } from '../models/index'; export interface EnrollOperationRequest { body?: EnrollRequest; } -export interface HttpHealthcheckOperationRequest { - body?: HttpHealthcheckRequest; -} - export interface PingRequest { body?: EnrollRequest; } @@ -87,6 +83,10 @@ export interface RemoteUnshareOperationRequest { body?: RemoteUnshareRequest; } +export interface ShareHttpHealthcheckOperationRequest { + body?: ShareHttpHealthcheckRequest; +} + export interface UnenrollRequest { body?: EnrollRequest; } @@ -130,40 +130,6 @@ export class AgentApi extends runtime.BaseAPI { return await response.value(); } - /** - */ - async httpHealthcheckRaw(requestParameters: HttpHealthcheckOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/zrok.v1+json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["x-token"] = await this.configuration.apiKey("x-token"); // key authentication - } - - - let urlPath = `/agent/share/http-healthcheck`; - - const response = await this.request({ - path: urlPath, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: HttpHealthcheckRequestToJSON(requestParameters['body']), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => HttpHealthcheck200ResponseFromJSON(jsonValue)); - } - - /** - */ - async httpHealthcheck(requestParameters: HttpHealthcheckOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.httpHealthcheckRaw(requestParameters, initOverrides); - return await response.value(); - } - /** */ async pingRaw(requestParameters: PingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { @@ -366,6 +332,40 @@ export class AgentApi extends runtime.BaseAPI { await this.remoteUnshareRaw(requestParameters, initOverrides); } + /** + */ + async shareHttpHealthcheckRaw(requestParameters: ShareHttpHealthcheckOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/zrok.v1+json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["x-token"] = await this.configuration.apiKey("x-token"); // key authentication + } + + + let urlPath = `/agent/share/http-healthcheck`; + + const response = await this.request({ + path: urlPath, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: ShareHttpHealthcheckRequestToJSON(requestParameters['body']), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ShareHttpHealthcheck200ResponseFromJSON(jsonValue)); + } + + /** + */ + async shareHttpHealthcheck(requestParameters: ShareHttpHealthcheckOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.shareHttpHealthcheckRaw(requestParameters, initOverrides); + return await response.value(); + } + /** */ async unenrollRaw(requestParameters: UnenrollRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { diff --git a/ui/src/api/models/HttpHealthcheck200Response.ts b/ui/src/api/models/HttpHealthcheck200Response.ts deleted file mode 100644 index 43483234..00000000 --- a/ui/src/api/models/HttpHealthcheck200Response.ts +++ /dev/null @@ -1,73 +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 HttpHealthcheck200Response - */ -export interface HttpHealthcheck200Response { - /** - * - * @type {boolean} - * @memberof HttpHealthcheck200Response - */ - healthy?: boolean; - /** - * - * @type {string} - * @memberof HttpHealthcheck200Response - */ - error?: string; -} - -/** - * Check if a given object implements the HttpHealthcheck200Response interface. - */ -export function instanceOfHttpHealthcheck200Response(value: object): value is HttpHealthcheck200Response { - return true; -} - -export function HttpHealthcheck200ResponseFromJSON(json: any): HttpHealthcheck200Response { - return HttpHealthcheck200ResponseFromJSONTyped(json, false); -} - -export function HttpHealthcheck200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HttpHealthcheck200Response { - if (json == null) { - return json; - } - return { - - 'healthy': json['healthy'] == null ? undefined : json['healthy'], - 'error': json['error'] == null ? undefined : json['error'], - }; -} - -export function HttpHealthcheck200ResponseToJSON(json: any): HttpHealthcheck200Response { - return HttpHealthcheck200ResponseToJSONTyped(json, false); -} - -export function HttpHealthcheck200ResponseToJSONTyped(value?: HttpHealthcheck200Response | null, ignoreDiscriminator: boolean = false): any { - if (value == null) { - return value; - } - - return { - - 'healthy': value['healthy'], - 'error': value['error'], - }; -} - diff --git a/ui/src/api/models/ShareHttpHealthcheck200Response.ts b/ui/src/api/models/ShareHttpHealthcheck200Response.ts new file mode 100644 index 00000000..511ab0ec --- /dev/null +++ b/ui/src/api/models/ShareHttpHealthcheck200Response.ts @@ -0,0 +1,73 @@ +/* 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 ShareHttpHealthcheck200Response + */ +export interface ShareHttpHealthcheck200Response { + /** + * + * @type {boolean} + * @memberof ShareHttpHealthcheck200Response + */ + healthy?: boolean; + /** + * + * @type {string} + * @memberof ShareHttpHealthcheck200Response + */ + error?: string; +} + +/** + * Check if a given object implements the ShareHttpHealthcheck200Response interface. + */ +export function instanceOfShareHttpHealthcheck200Response(value: object): value is ShareHttpHealthcheck200Response { + return true; +} + +export function ShareHttpHealthcheck200ResponseFromJSON(json: any): ShareHttpHealthcheck200Response { + return ShareHttpHealthcheck200ResponseFromJSONTyped(json, false); +} + +export function ShareHttpHealthcheck200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ShareHttpHealthcheck200Response { + if (json == null) { + return json; + } + return { + + 'healthy': json['healthy'] == null ? undefined : json['healthy'], + 'error': json['error'] == null ? undefined : json['error'], + }; +} + +export function ShareHttpHealthcheck200ResponseToJSON(json: any): ShareHttpHealthcheck200Response { + return ShareHttpHealthcheck200ResponseToJSONTyped(json, false); +} + +export function ShareHttpHealthcheck200ResponseToJSONTyped(value?: ShareHttpHealthcheck200Response | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'healthy': value['healthy'], + 'error': value['error'], + }; +} + diff --git a/ui/src/api/models/HttpHealthcheckRequest.ts b/ui/src/api/models/ShareHttpHealthcheckRequest.ts similarity index 60% rename from ui/src/api/models/HttpHealthcheckRequest.ts rename to ui/src/api/models/ShareHttpHealthcheckRequest.ts index dfa12b7e..b0baec66 100644 --- a/ui/src/api/models/HttpHealthcheckRequest.ts +++ b/ui/src/api/models/ShareHttpHealthcheckRequest.ts @@ -16,59 +16,59 @@ import { mapValues } from '../runtime'; /** * * @export - * @interface HttpHealthcheckRequest + * @interface ShareHttpHealthcheckRequest */ -export interface HttpHealthcheckRequest { +export interface ShareHttpHealthcheckRequest { /** * * @type {string} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ envZId?: string; /** * * @type {string} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ shareToken?: string; /** * * @type {string} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ httpVerb?: string; /** * * @type {string} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ endpoint?: string; /** * * @type {number} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ expectedHttpResponse?: number; /** * * @type {number} - * @memberof HttpHealthcheckRequest + * @memberof ShareHttpHealthcheckRequest */ timeoutMs?: number; } /** - * Check if a given object implements the HttpHealthcheckRequest interface. + * Check if a given object implements the ShareHttpHealthcheckRequest interface. */ -export function instanceOfHttpHealthcheckRequest(value: object): value is HttpHealthcheckRequest { +export function instanceOfShareHttpHealthcheckRequest(value: object): value is ShareHttpHealthcheckRequest { return true; } -export function HttpHealthcheckRequestFromJSON(json: any): HttpHealthcheckRequest { - return HttpHealthcheckRequestFromJSONTyped(json, false); +export function ShareHttpHealthcheckRequestFromJSON(json: any): ShareHttpHealthcheckRequest { + return ShareHttpHealthcheckRequestFromJSONTyped(json, false); } -export function HttpHealthcheckRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): HttpHealthcheckRequest { +export function ShareHttpHealthcheckRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ShareHttpHealthcheckRequest { if (json == null) { return json; } @@ -83,11 +83,11 @@ export function HttpHealthcheckRequestFromJSONTyped(json: any, ignoreDiscriminat }; } -export function HttpHealthcheckRequestToJSON(json: any): HttpHealthcheckRequest { - return HttpHealthcheckRequestToJSONTyped(json, false); +export function ShareHttpHealthcheckRequestToJSON(json: any): ShareHttpHealthcheckRequest { + return ShareHttpHealthcheckRequestToJSONTyped(json, false); } -export function HttpHealthcheckRequestToJSONTyped(value?: HttpHealthcheckRequest | null, ignoreDiscriminator: boolean = false): any { +export function ShareHttpHealthcheckRequestToJSONTyped(value?: ShareHttpHealthcheckRequest | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } diff --git a/ui/src/api/models/index.ts b/ui/src/api/models/index.ts index 726eb992..840bbd14 100644 --- a/ui/src/api/models/index.ts +++ b/ui/src/api/models/index.ts @@ -23,8 +23,6 @@ export * from './EnvironmentAndResources'; export * from './Frontend'; export * from './GetSparklines200Response'; export * from './GetSparklinesRequest'; -export * from './HttpHealthcheck200Response'; -export * from './HttpHealthcheckRequest'; export * from './InviteRequest'; export * from './InviteTokenGenerateRequest'; export * from './ListFrontends200ResponseInner'; @@ -57,6 +55,8 @@ export * from './RemoteUnshareRequest'; export * from './RemoveOrganizationMemberRequest'; export * from './ResetPasswordRequest'; export * from './Share'; +export * from './ShareHttpHealthcheck200Response'; +export * from './ShareHttpHealthcheckRequest'; export * from './ShareRequest'; export * from './ShareResponse'; export * from './SparkDataSample';