rough in '/agent/share/http-healthcheck' for remoted healthchecks (#1002)

This commit is contained in:
Michael Quigley
2025-07-18 11:57:30 -04:00
parent a73125977b
commit b99e414fce
37 changed files with 2536 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ apis/index.ts
index.ts
models/AccessDetail.ts
models/AccessPrivateResponse.ts
models/HttpShareHealthcheckResponse.ts
models/ProtobufAny.ts
models/RpcStatus.ts
models/ShareDetail.ts

View File

@@ -16,6 +16,7 @@
import * as runtime from '../runtime';
import type {
AccessPrivateResponse,
HttpShareHealthcheckResponse,
RpcStatus,
SharePrivateResponse,
SharePublicResponse,
@@ -25,6 +26,8 @@ import type {
import {
AccessPrivateResponseFromJSON,
AccessPrivateResponseToJSON,
HttpShareHealthcheckResponseFromJSON,
HttpShareHealthcheckResponseToJSON,
RpcStatusFromJSON,
RpcStatusToJSON,
SharePrivateResponseFromJSON,
@@ -47,6 +50,14 @@ export interface AgentAccessPrivateRequest {
responseHeaders?: Array<string>;
}
export interface AgentHttpShareHealthcheckRequest {
token?: string;
httpVerb?: string;
endpoint?: string;
expectedHttpResponse?: string;
timeoutMs?: string;
}
export interface AgentReleaseAccessRequest {
frontendToken?: string;
}
@@ -136,6 +147,53 @@ export class AgentApi extends runtime.BaseAPI {
return await response.value();
}
/**
*/
async agentHttpShareHealthcheckRaw(requestParameters: AgentHttpShareHealthcheckRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HttpShareHealthcheckResponse>> {
const queryParameters: any = {};
if (requestParameters['token'] != null) {
queryParameters['token'] = requestParameters['token'];
}
if (requestParameters['httpVerb'] != null) {
queryParameters['httpVerb'] = requestParameters['httpVerb'];
}
if (requestParameters['endpoint'] != null) {
queryParameters['endpoint'] = requestParameters['endpoint'];
}
if (requestParameters['expectedHttpResponse'] != null) {
queryParameters['expectedHttpResponse'] = requestParameters['expectedHttpResponse'];
}
if (requestParameters['timeoutMs'] != null) {
queryParameters['timeoutMs'] = requestParameters['timeoutMs'];
}
const headerParameters: runtime.HTTPHeaders = {};
let urlPath = `/v1/agent/httpShareHealthcheck`;
const response = await this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HttpShareHealthcheckResponseFromJSON(jsonValue));
}
/**
*/
async agentHttpShareHealthcheck(requestParameters: AgentHttpShareHealthcheckRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HttpShareHealthcheckResponse> {
const response = await this.agentHttpShareHealthcheckRaw(requestParameters, initOverrides);
return await response.value();
}
/**
*/
async agentReleaseAccessRaw(requestParameters: AgentReleaseAccessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<object>> {

View File

@@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* agent/agentGrpc/agent.proto
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: version not set
*
*
* 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 HttpShareHealthcheckResponse
*/
export interface HttpShareHealthcheckResponse {
/**
*
* @type {boolean}
* @memberof HttpShareHealthcheckResponse
*/
healthy?: boolean;
/**
*
* @type {string}
* @memberof HttpShareHealthcheckResponse
*/
error?: string;
}
/**
* Check if a given object implements the HttpShareHealthcheckResponse interface.
*/
export function instanceOfHttpShareHealthcheckResponse(value: object): value is HttpShareHealthcheckResponse {
return true;
}
export function HttpShareHealthcheckResponseFromJSON(json: any): HttpShareHealthcheckResponse {
return HttpShareHealthcheckResponseFromJSONTyped(json, false);
}
export function HttpShareHealthcheckResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HttpShareHealthcheckResponse {
if (json == null) {
return json;
}
return {
'healthy': json['healthy'] == null ? undefined : json['healthy'],
'error': json['error'] == null ? undefined : json['error'],
};
}
export function HttpShareHealthcheckResponseToJSON(json: any): HttpShareHealthcheckResponse {
return HttpShareHealthcheckResponseToJSONTyped(json, false);
}
export function HttpShareHealthcheckResponseToJSONTyped(value?: HttpShareHealthcheckResponse | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'healthy': value['healthy'],
'error': value['error'],
};
}

View File

@@ -2,6 +2,7 @@
/* eslint-disable */
export * from './AccessDetail';
export * from './AccessPrivateResponse';
export * from './HttpShareHealthcheckResponse';
export * from './ProtobufAny';
export * from './RpcStatus';
export * from './ShareDetail';

View File

@@ -32,6 +32,8 @@ 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)
@@ -88,6 +90,45 @@ 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
*/

View File

@@ -0,0 +1,146 @@
// Code generated by go-swagger; DO NOT EDIT.
package agent
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// 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
}

View File

@@ -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"
)
// 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
}

View File

@@ -508,6 +508,71 @@ func init() {
}
}
},
"/agent/share/http-healthcheck": {
"post": {
"security": [
{
"key": []
}
],
"tags": [
"agent"
],
"operationId": "httpHealthcheck",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
"properties": {
"endpoint": {
"type": "string"
},
"envZId": {
"type": "string"
},
"expectedHttpResponse": {
"type": "number"
},
"httpVerb": {
"type": "string"
},
"shareToken": {
"type": "string"
},
"timeoutMs": {
"type": "number"
}
}
}
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"properties": {
"error": {
"type": "string"
},
"healthy": {
"type": "boolean"
}
}
}
},
"401": {
"description": "unauthorized"
},
"500": {
"description": "internal server error"
},
"502": {
"description": "bad gateway; agent not reachable"
}
}
}
},
"/agent/status": {
"post": {
"security": [
@@ -3548,6 +3613,71 @@ func init() {
}
}
},
"/agent/share/http-healthcheck": {
"post": {
"security": [
{
"key": []
}
],
"tags": [
"agent"
],
"operationId": "httpHealthcheck",
"parameters": [
{
"name": "body",
"in": "body",
"schema": {
"properties": {
"endpoint": {
"type": "string"
},
"envZId": {
"type": "string"
},
"expectedHttpResponse": {
"type": "number"
},
"httpVerb": {
"type": "string"
},
"shareToken": {
"type": "string"
},
"timeoutMs": {
"type": "number"
}
}
}
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"properties": {
"error": {
"type": "string"
},
"healthy": {
"type": "boolean"
}
}
}
},
"401": {
"description": "unauthorized"
},
"500": {
"description": "internal server error"
},
"502": {
"description": "bad gateway; agent not reachable"
}
}
}
},
"/agent/status": {
"post": {
"security": [

View File

@@ -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"
)
// 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
}

View File

@@ -0,0 +1,74 @@
// 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/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/validate"
)
// NewHTTPHealthcheckParams creates a new HTTPHealthcheckParams object
//
// There are no default values defined in the spec.
func NewHTTPHealthcheckParams() HTTPHealthcheckParams {
return HTTPHealthcheckParams{}
}
// HTTPHealthcheckParams contains all the bound params for the http healthcheck operation
// typically these are obtained from a http.Request
//
// swagger:parameters httpHealthcheck
type HTTPHealthcheckParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
In: body
*/
Body HTTPHealthcheckBody
}
// 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 {
var res []error
o.HTTPRequest = r
if runtime.HasBody(r) {
defer r.Body.Close()
var body HTTPHealthcheckBody
if err := route.Consumer.Consume(r.Body, &body); err != nil {
res = append(res, errors.NewParseError("body", "body", "", err))
} else {
// validate body object
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
ctx := validate.WithOperationRequest(r.Context())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Body = body
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,132 @@
// Code generated by go-swagger; DO NOT EDIT.
package agent
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
)
// 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)
}

View File

@@ -0,0 +1,87 @@
// 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 (
"errors"
"net/url"
golangswaggerpaths "path"
)
// HTTPHealthcheckURL generates an URL for the http healthcheck operation
type HTTPHealthcheckURL 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 {
o.SetBasePath(bp)
return o
}
// 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) {
o._basePath = bp
}
// Build a url path and query string
func (o *HTTPHealthcheckURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/agent/share/http-healthcheck"
_basePath := o._basePath
if _basePath == "" {
_basePath = "/api/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// 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 {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *HTTPHealthcheckURL) 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) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on HTTPHealthcheckURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on HTTPHealthcheckURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *HTTPHealthcheckURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -131,6 +131,9 @@ 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")
}),
@@ -331,6 +334,8 @@ 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
@@ -557,6 +562,9 @@ 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")
}
@@ -863,6 +871,10 @@ 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)

View File

@@ -30,6 +30,8 @@ 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

View File

@@ -18,6 +18,8 @@ import type {
CreateFrontend201Response,
Enroll200Response,
EnrollRequest,
HttpHealthcheck200Response,
HttpHealthcheckRequest,
Ping200Response,
RemoteAccessRequest,
RemoteShare200Response,
@@ -33,6 +35,10 @@ import {
Enroll200ResponseToJSON,
EnrollRequestFromJSON,
EnrollRequestToJSON,
HttpHealthcheck200ResponseFromJSON,
HttpHealthcheck200ResponseToJSON,
HttpHealthcheckRequestFromJSON,
HttpHealthcheckRequestToJSON,
Ping200ResponseFromJSON,
Ping200ResponseToJSON,
RemoteAccessRequestFromJSON,
@@ -53,6 +59,10 @@ export interface EnrollOperationRequest {
body?: EnrollRequest;
}
export interface HttpHealthcheckOperationRequest {
body?: HttpHealthcheckRequest;
}
export interface PingRequest {
body?: EnrollRequest;
}
@@ -120,6 +130,40 @@ export class AgentApi extends runtime.BaseAPI {
return await response.value();
}
/**
*/
async httpHealthcheckRaw(requestParameters: HttpHealthcheckOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HttpHealthcheck200Response>> {
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<HttpHealthcheck200Response> {
const response = await this.httpHealthcheckRaw(requestParameters, initOverrides);
return await response.value();
}
/**
*/
async pingRaw(requestParameters: PingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Ping200Response>> {

View File

@@ -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 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'],
};
}

View File

@@ -0,0 +1,105 @@
/* 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 HttpHealthcheckRequest
*/
export interface HttpHealthcheckRequest {
/**
*
* @type {string}
* @memberof HttpHealthcheckRequest
*/
envZId?: string;
/**
*
* @type {string}
* @memberof HttpHealthcheckRequest
*/
shareToken?: string;
/**
*
* @type {string}
* @memberof HttpHealthcheckRequest
*/
httpVerb?: string;
/**
*
* @type {string}
* @memberof HttpHealthcheckRequest
*/
endpoint?: string;
/**
*
* @type {number}
* @memberof HttpHealthcheckRequest
*/
expectedHttpResponse?: number;
/**
*
* @type {number}
* @memberof HttpHealthcheckRequest
*/
timeoutMs?: number;
}
/**
* Check if a given object implements the HttpHealthcheckRequest interface.
*/
export function instanceOfHttpHealthcheckRequest(value: object): value is HttpHealthcheckRequest {
return true;
}
export function HttpHealthcheckRequestFromJSON(json: any): HttpHealthcheckRequest {
return HttpHealthcheckRequestFromJSONTyped(json, false);
}
export function HttpHealthcheckRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): HttpHealthcheckRequest {
if (json == null) {
return json;
}
return {
'envZId': json['envZId'] == null ? undefined : json['envZId'],
'shareToken': json['shareToken'] == null ? undefined : json['shareToken'],
'httpVerb': json['httpVerb'] == null ? undefined : json['httpVerb'],
'endpoint': json['endpoint'] == null ? undefined : json['endpoint'],
'expectedHttpResponse': json['expectedHttpResponse'] == null ? undefined : json['expectedHttpResponse'],
'timeoutMs': json['timeoutMs'] == null ? undefined : json['timeoutMs'],
};
}
export function HttpHealthcheckRequestToJSON(json: any): HttpHealthcheckRequest {
return HttpHealthcheckRequestToJSONTyped(json, false);
}
export function HttpHealthcheckRequestToJSONTyped(value?: HttpHealthcheckRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'envZId': value['envZId'],
'shareToken': value['shareToken'],
'httpVerb': value['httpVerb'],
'endpoint': value['endpoint'],
'expectedHttpResponse': value['expectedHttpResponse'],
'timeoutMs': value['timeoutMs'],
};
}

View File

@@ -23,6 +23,8 @@ 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';

View File

@@ -28,6 +28,8 @@ 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
@@ -103,6 +105,8 @@ 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
@@ -184,6 +188,8 @@ 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

View File

@@ -119,6 +119,7 @@ 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 |
@@ -179,6 +180,8 @@ 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)

View File

@@ -5,6 +5,7 @@ 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 |
@@ -92,6 +93,84 @@ 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)

View File

@@ -0,0 +1,30 @@
# 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)

View File

@@ -0,0 +1,34 @@
# HttpHealthcheckRequest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**env_zid** | **str** | | [optional]
**share_token** | **str** | | [optional]
**http_verb** | **str** | | [optional]
**endpoint** | **str** | | [optional]
**expected_http_response** | **float** | | [optional]
**timeout_ms** | **float** | | [optional]
## Example
```python
from zrok_api.models.http_healthcheck_request import HttpHealthcheckRequest
# TODO update the JSON string below
json = "{}"
# create an instance of HttpHealthcheckRequest from a JSON string
http_healthcheck_request_instance = HttpHealthcheckRequest.from_json(json)
# print the JSON string representation of the object
print(HttpHealthcheckRequest.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)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -32,6 +32,12 @@ 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

View File

@@ -0,0 +1,52 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from zrok_api.models.http_healthcheck200_response import HttpHealthcheck200Response
class TestHttpHealthcheck200Response(unittest.TestCase):
"""HttpHealthcheck200Response unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> HttpHealthcheck200Response:
"""Test HttpHealthcheck200Response
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`
"""
model = HttpHealthcheck200Response()
if include_optional:
return HttpHealthcheck200Response(
healthy = True,
error = ''
)
else:
return HttpHealthcheck200Response(
)
"""
def testHttpHealthcheck200Response(self):
"""Test HttpHealthcheck200Response"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,56 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from zrok_api.models.http_healthcheck_request import HttpHealthcheckRequest
class TestHttpHealthcheckRequest(unittest.TestCase):
"""HttpHealthcheckRequest unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> HttpHealthcheckRequest:
"""Test HttpHealthcheckRequest
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`
"""
model = HttpHealthcheckRequest()
if include_optional:
return HttpHealthcheckRequest(
env_zid = '',
share_token = '',
http_verb = '',
endpoint = '',
expected_http_response = 1.337,
timeout_ms = 1.337
)
else:
return HttpHealthcheckRequest(
)
"""
def testHttpHealthcheckRequest(self):
"""Test HttpHealthcheckRequest"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -57,6 +57,8 @@ __all__ = [
"Frontend",
"GetSparklines200Response",
"GetSparklinesRequest",
"HttpHealthcheck200Response",
"HttpHealthcheckRequest",
"InviteRequest",
"InviteTokenGenerateRequest",
"ListFrontends200ResponseInner",
@@ -145,6 +147,8 @@ 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

View File

@@ -20,6 +20,8 @@ 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
@@ -326,6 +328,286 @@ 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,

View File

@@ -38,6 +38,8 @@ 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

View File

@@ -0,0 +1,89 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self
class HttpHealthcheck200Response(BaseModel):
"""
HttpHealthcheck200Response
""" # noqa: E501
healthy: Optional[StrictBool] = None
error: Optional[StrictStr] = None
__properties: ClassVar[List[str]] = ["healthy", "error"]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of HttpHealthcheck200Response from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of HttpHealthcheck200Response from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"healthy": obj.get("healthy"),
"error": obj.get("error")
})
return _obj

View File

@@ -0,0 +1,97 @@
# coding: utf-8
"""
zrok
zrok client access
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import pprint
import re # noqa: F401
import json
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self
class HttpHealthcheckRequest(BaseModel):
"""
HttpHealthcheckRequest
""" # noqa: E501
env_zid: Optional[StrictStr] = Field(default=None, alias="envZId")
share_token: Optional[StrictStr] = Field(default=None, alias="shareToken")
http_verb: Optional[StrictStr] = Field(default=None, alias="httpVerb")
endpoint: Optional[StrictStr] = None
expected_http_response: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="expectedHttpResponse")
timeout_ms: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="timeoutMs")
__properties: ClassVar[List[str]] = ["envZId", "shareToken", "httpVerb", "endpoint", "expectedHttpResponse", "timeoutMs"]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of HttpHealthcheckRequest from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of HttpHealthcheckRequest from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"envZId": obj.get("envZId"),
"shareToken": obj.get("shareToken"),
"httpVerb": obj.get("httpVerb"),
"endpoint": obj.get("endpoint"),
"expectedHttpResponse": obj.get("expectedHttpResponse"),
"timeoutMs": obj.get("timeoutMs")
})
return _obj

View File

@@ -886,6 +886,46 @@ paths:
502:
description: bad gateway; agent not reachable
/agent/share/http-healthcheck:
post:
tags:
- agent
security:
- key: []
operationId: httpHealthcheck
parameters:
- name: body
in: body
schema:
properties:
envZId:
type: string
shareToken:
type: string
httpVerb:
type: string
endpoint:
type: string
expectedHttpResponse:
type: number
timeoutMs:
type: number
responses:
200:
description: ok
schema:
properties:
healthy:
type: boolean
error:
type: string
401:
description: unauthorized
500:
description: internal server error
502:
description: bad gateway; agent not reachable
/agent/status:
post:
tags:

View File

@@ -30,6 +30,8 @@ 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

View File

@@ -18,6 +18,8 @@ import type {
CreateFrontend201Response,
Enroll200Response,
EnrollRequest,
HttpHealthcheck200Response,
HttpHealthcheckRequest,
Ping200Response,
RemoteAccessRequest,
RemoteShare200Response,
@@ -33,6 +35,10 @@ import {
Enroll200ResponseToJSON,
EnrollRequestFromJSON,
EnrollRequestToJSON,
HttpHealthcheck200ResponseFromJSON,
HttpHealthcheck200ResponseToJSON,
HttpHealthcheckRequestFromJSON,
HttpHealthcheckRequestToJSON,
Ping200ResponseFromJSON,
Ping200ResponseToJSON,
RemoteAccessRequestFromJSON,
@@ -53,6 +59,10 @@ export interface EnrollOperationRequest {
body?: EnrollRequest;
}
export interface HttpHealthcheckOperationRequest {
body?: HttpHealthcheckRequest;
}
export interface PingRequest {
body?: EnrollRequest;
}
@@ -120,6 +130,40 @@ export class AgentApi extends runtime.BaseAPI {
return await response.value();
}
/**
*/
async httpHealthcheckRaw(requestParameters: HttpHealthcheckOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HttpHealthcheck200Response>> {
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<HttpHealthcheck200Response> {
const response = await this.httpHealthcheckRaw(requestParameters, initOverrides);
return await response.value();
}
/**
*/
async pingRaw(requestParameters: PingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Ping200Response>> {

View File

@@ -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 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'],
};
}

View File

@@ -0,0 +1,105 @@
/* 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 HttpHealthcheckRequest
*/
export interface HttpHealthcheckRequest {
/**
*
* @type {string}
* @memberof HttpHealthcheckRequest
*/
envZId?: string;
/**
*
* @type {string}
* @memberof HttpHealthcheckRequest
*/
shareToken?: string;
/**
*
* @type {string}
* @memberof HttpHealthcheckRequest
*/
httpVerb?: string;
/**
*
* @type {string}
* @memberof HttpHealthcheckRequest
*/
endpoint?: string;
/**
*
* @type {number}
* @memberof HttpHealthcheckRequest
*/
expectedHttpResponse?: number;
/**
*
* @type {number}
* @memberof HttpHealthcheckRequest
*/
timeoutMs?: number;
}
/**
* Check if a given object implements the HttpHealthcheckRequest interface.
*/
export function instanceOfHttpHealthcheckRequest(value: object): value is HttpHealthcheckRequest {
return true;
}
export function HttpHealthcheckRequestFromJSON(json: any): HttpHealthcheckRequest {
return HttpHealthcheckRequestFromJSONTyped(json, false);
}
export function HttpHealthcheckRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): HttpHealthcheckRequest {
if (json == null) {
return json;
}
return {
'envZId': json['envZId'] == null ? undefined : json['envZId'],
'shareToken': json['shareToken'] == null ? undefined : json['shareToken'],
'httpVerb': json['httpVerb'] == null ? undefined : json['httpVerb'],
'endpoint': json['endpoint'] == null ? undefined : json['endpoint'],
'expectedHttpResponse': json['expectedHttpResponse'] == null ? undefined : json['expectedHttpResponse'],
'timeoutMs': json['timeoutMs'] == null ? undefined : json['timeoutMs'],
};
}
export function HttpHealthcheckRequestToJSON(json: any): HttpHealthcheckRequest {
return HttpHealthcheckRequestToJSONTyped(json, false);
}
export function HttpHealthcheckRequestToJSONTyped(value?: HttpHealthcheckRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'envZId': value['envZId'],
'shareToken': value['shareToken'],
'httpVerb': value['httpVerb'],
'endpoint': value['endpoint'],
'expectedHttpResponse': value['expectedHttpResponse'],
'timeoutMs': value['timeoutMs'],
};
}

View File

@@ -23,6 +23,8 @@ 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';