mirror of
https://github.com/openziti/zrok.git
synced 2024-12-22 06:40:50 +01:00
remove service03 type; consolidated service type (#119)
This commit is contained in:
parent
b80eb4f837
commit
44f4e37e83
@ -40,12 +40,14 @@ func getServiceHandler(params service.GetServiceParams, principal *rest_model_zr
|
||||
return service.NewGetServiceNotFound()
|
||||
}
|
||||
|
||||
svc := &rest_model_zrok.Service03{
|
||||
svc := &rest_model_zrok.Service{
|
||||
Token: ssvc.Token,
|
||||
ZID: ssvc.ZId,
|
||||
ShareMode: ssvc.ShareMode,
|
||||
BackendMode: ssvc.BackendMode,
|
||||
Reserved: ssvc.Reserved,
|
||||
CreatedAt: ssvc.CreatedAt.UnixMilli(),
|
||||
UpdatedAt: ssvc.UpdatedAt.UnixMilli(),
|
||||
}
|
||||
if ssvc.FrontendSelection != nil {
|
||||
svc.FrontendSelection = *ssvc.FrontendSelection
|
||||
|
@ -45,22 +45,30 @@ func overviewHandler(_ metadata.OverviewParams, principal *rest_model_zrok.Princ
|
||||
return metadata.NewOverviewInternalServerError()
|
||||
}
|
||||
for _, svc := range svcs {
|
||||
fe := ""
|
||||
feEndpoint := ""
|
||||
if svc.FrontendEndpoint != nil {
|
||||
fe = *svc.FrontendEndpoint
|
||||
feEndpoint = *svc.FrontendEndpoint
|
||||
}
|
||||
be := ""
|
||||
feSelection := ""
|
||||
if svc.FrontendSelection != nil {
|
||||
feSelection = *svc.FrontendSelection
|
||||
}
|
||||
beProxyEndpoint := ""
|
||||
if svc.BackendProxyEndpoint != nil {
|
||||
be = *svc.BackendProxyEndpoint
|
||||
beProxyEndpoint = *svc.BackendProxyEndpoint
|
||||
}
|
||||
es.Services = append(es.Services, &rest_model_zrok.Service{
|
||||
CreatedAt: svc.CreatedAt.UnixMilli(),
|
||||
FrontendEndpoint: fe,
|
||||
BackendProxyEndpoint: be,
|
||||
UpdatedAt: svc.UpdatedAt.UnixMilli(),
|
||||
ZID: svc.ZId,
|
||||
Token: svc.Token,
|
||||
ZID: svc.ZId,
|
||||
ShareMode: svc.ShareMode,
|
||||
BackendMode: svc.BackendMode,
|
||||
FrontendSelection: feSelection,
|
||||
FrontendEndpoint: feEndpoint,
|
||||
BackendProxyEndpoint: beProxyEndpoint,
|
||||
Reserved: svc.Reserved,
|
||||
Metrics: sparkData[svc.Token],
|
||||
CreatedAt: svc.CreatedAt.UnixMilli(),
|
||||
UpdatedAt: svc.UpdatedAt.UnixMilli(),
|
||||
})
|
||||
}
|
||||
out = append(out, es)
|
||||
|
@ -63,7 +63,7 @@ GetServiceOK describes a response with status code 200, with default header valu
|
||||
ok
|
||||
*/
|
||||
type GetServiceOK struct {
|
||||
Payload *rest_model_zrok.Service03
|
||||
Payload *rest_model_zrok.Service
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this get service o k response has a 2xx status code
|
||||
@ -99,13 +99,13 @@ func (o *GetServiceOK) String() string {
|
||||
return fmt.Sprintf("[GET /service][%d] getServiceOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *GetServiceOK) GetPayload() *rest_model_zrok.Service03 {
|
||||
func (o *GetServiceOK) GetPayload() *rest_model_zrok.Service {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *GetServiceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(rest_model_zrok.Service03)
|
||||
o.Payload = new(rest_model_zrok.Service)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
|
@ -18,6 +18,9 @@ import (
|
||||
// swagger:model service
|
||||
type Service struct {
|
||||
|
||||
// backend mode
|
||||
BackendMode string `json:"backendMode,omitempty"`
|
||||
|
||||
// backend proxy endpoint
|
||||
BackendProxyEndpoint string `json:"backendProxyEndpoint,omitempty"`
|
||||
|
||||
@ -27,9 +30,18 @@ type Service struct {
|
||||
// frontend endpoint
|
||||
FrontendEndpoint string `json:"frontendEndpoint,omitempty"`
|
||||
|
||||
// frontend selection
|
||||
FrontendSelection string `json:"frontendSelection,omitempty"`
|
||||
|
||||
// metrics
|
||||
Metrics ServiceMetrics `json:"metrics,omitempty"`
|
||||
|
||||
// reserved
|
||||
Reserved bool `json:"reserved,omitempty"`
|
||||
|
||||
// share mode
|
||||
ShareMode string `json:"shareMode,omitempty"`
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
|
||||
|
@ -1,71 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package rest_model_zrok
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// Service03 service03
|
||||
//
|
||||
// swagger:model service03
|
||||
type Service03 struct {
|
||||
|
||||
// backend mode
|
||||
BackendMode string `json:"backendMode,omitempty"`
|
||||
|
||||
// backend proxy endpoint
|
||||
BackendProxyEndpoint string `json:"backendProxyEndpoint,omitempty"`
|
||||
|
||||
// frontend endpoint
|
||||
FrontendEndpoint string `json:"frontendEndpoint,omitempty"`
|
||||
|
||||
// frontend selection
|
||||
FrontendSelection string `json:"frontendSelection,omitempty"`
|
||||
|
||||
// reserved
|
||||
Reserved bool `json:"reserved,omitempty"`
|
||||
|
||||
// share mode
|
||||
ShareMode string `json:"shareMode,omitempty"`
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
|
||||
// z Id
|
||||
ZID string `json:"zId,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this service03
|
||||
func (m *Service03) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this service03 based on context it is used
|
||||
func (m *Service03) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Service03) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Service03) UnmarshalBinary(b []byte) error {
|
||||
var res Service03
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
@ -284,7 +284,7 @@ func init() {
|
||||
"200": {
|
||||
"description": "ok",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service03"
|
||||
"$ref": "#/definitions/service"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -632,6 +632,9 @@ func init() {
|
||||
"service": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"backendProxyEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -641,35 +644,12 @@ func init() {
|
||||
"frontendEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"metrics": {
|
||||
"$ref": "#/definitions/serviceMetrics"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"service03": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"backendProxyEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendSelection": {
|
||||
"type": "string"
|
||||
},
|
||||
"metrics": {
|
||||
"$ref": "#/definitions/serviceMetrics"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@ -679,6 +659,9 @@ func init() {
|
||||
"token": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
@ -1085,7 +1068,7 @@ func init() {
|
||||
"200": {
|
||||
"description": "ok",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/service03"
|
||||
"$ref": "#/definitions/service"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
@ -1433,6 +1416,9 @@ func init() {
|
||||
"service": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"backendProxyEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -1442,35 +1428,12 @@ func init() {
|
||||
"frontendEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"metrics": {
|
||||
"$ref": "#/definitions/serviceMetrics"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"service03": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"backendMode": {
|
||||
"type": "string"
|
||||
},
|
||||
"backendProxyEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"frontendSelection": {
|
||||
"type": "string"
|
||||
},
|
||||
"metrics": {
|
||||
"$ref": "#/definitions/serviceMetrics"
|
||||
},
|
||||
"reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@ -1480,6 +1443,9 @@ func init() {
|
||||
"token": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ type GetServiceOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *rest_model_zrok.Service03 `json:"body,omitempty"`
|
||||
Payload *rest_model_zrok.Service `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetServiceOK creates GetServiceOK with default headers values
|
||||
@ -36,13 +36,13 @@ func NewGetServiceOK() *GetServiceOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get service o k response
|
||||
func (o *GetServiceOK) WithPayload(payload *rest_model_zrok.Service03) *GetServiceOK {
|
||||
func (o *GetServiceOK) WithPayload(payload *rest_model_zrok.Service) *GetServiceOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get service o k response
|
||||
func (o *GetServiceOK) SetPayload(payload *rest_model_zrok.Service03) {
|
||||
func (o *GetServiceOK) SetPayload(payload *rest_model_zrok.Service) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ paths:
|
||||
200:
|
||||
description: ok
|
||||
schema:
|
||||
$ref: "#/definitions/service03"
|
||||
$ref: "#/definitions/service"
|
||||
401:
|
||||
description: unauthorized
|
||||
404:
|
||||
@ -414,7 +414,7 @@ definitions:
|
||||
token:
|
||||
type: string
|
||||
|
||||
service03:
|
||||
service:
|
||||
type: object
|
||||
properties:
|
||||
token:
|
||||
@ -433,18 +433,6 @@ definitions:
|
||||
type: string
|
||||
reserved:
|
||||
type: boolean
|
||||
|
||||
service:
|
||||
type: object
|
||||
properties:
|
||||
zId:
|
||||
type: string
|
||||
token:
|
||||
type: string
|
||||
frontendEndpoint:
|
||||
type: string
|
||||
backendProxyEndpoint:
|
||||
type: string
|
||||
metrics:
|
||||
$ref: "#/definitions/serviceMetrics"
|
||||
createdAt:
|
||||
|
@ -20,7 +20,7 @@ export function access(options) {
|
||||
/**
|
||||
* @param {object} options Optional options
|
||||
* @param {module:types.serviceRequest} [options.body]
|
||||
* @return {Promise<module:types.service03>} ok
|
||||
* @return {Promise<module:types.service>} ok
|
||||
*/
|
||||
export function getService(options) {
|
||||
if (!options) options = {}
|
||||
|
@ -108,7 +108,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef service03
|
||||
* @typedef service
|
||||
* @memberof module:types
|
||||
*
|
||||
* @property {string} token
|
||||
@ -119,16 +119,6 @@
|
||||
* @property {string} frontendEndpoint
|
||||
* @property {string} backendProxyEndpoint
|
||||
* @property {boolean} reserved
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef service
|
||||
* @memberof module:types
|
||||
*
|
||||
* @property {string} zId
|
||||
* @property {string} token
|
||||
* @property {string} frontendEndpoint
|
||||
* @property {string} backendProxyEndpoint
|
||||
* @property {module:types.serviceMetrics} metrics
|
||||
* @property {number} createdAt
|
||||
* @property {number} updatedAt
|
||||
|
Loading…
Reference in New Issue
Block a user