mirror of
https://github.com/openziti/zrok.git
synced 2024-11-24 17:13:51 +01:00
list frontends backend (#129)
This commit is contained in:
parent
db19dfbb77
commit
d5d2497955
@ -33,6 +33,7 @@ func Run(inCfg *Config) error {
|
||||
api.AccountVerifyHandler = newVerifyHandler()
|
||||
api.AdminCreateFrontendHandler = newCreateFrontendHandler()
|
||||
api.AdminDeleteFrontendHandler = newDeleteFrontendHandler()
|
||||
api.AdminListFrontendsHandler = newListFrontendsHandler()
|
||||
api.EnvironmentEnableHandler = newEnableHandler()
|
||||
api.EnvironmentDisableHandler = newDisableHandler()
|
||||
api.MetadataOverviewHandler = metadata.OverviewHandlerFunc(overviewHandler)
|
||||
|
52
controller/list_frontends.go
Normal file
52
controller/list_frontends.go
Normal file
@ -0,0 +1,52 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_server_zrok/operations/admin"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type listFrontendsHandler struct{}
|
||||
|
||||
func newListFrontendsHandler() *listFrontendsHandler {
|
||||
return &listFrontendsHandler{}
|
||||
}
|
||||
|
||||
func (h *listFrontendsHandler) Handle(params admin.ListFrontendsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
if !principal.Admin {
|
||||
logrus.Errorf("invalid admin principal")
|
||||
return admin.NewListFrontendsUnauthorized()
|
||||
}
|
||||
|
||||
tx, err := str.Begin()
|
||||
if err != nil {
|
||||
logrus.Errorf("error starting transaction: %v", err)
|
||||
return admin.NewListFrontendsInternalServerError()
|
||||
}
|
||||
defer func() { _ = tx.Rollback() }()
|
||||
|
||||
sfes, err := str.FindPublicFrontends(tx)
|
||||
if err != nil {
|
||||
logrus.Errorf("error finding public frontends: %v", err)
|
||||
return admin.NewListFrontendsInternalServerError()
|
||||
}
|
||||
|
||||
var frontends rest_model_zrok.PublicFrontendList
|
||||
for _, sfe := range sfes {
|
||||
frontend := &rest_model_zrok.PublicFrontend{
|
||||
Token: sfe.Token,
|
||||
ZID: sfe.ZId,
|
||||
CreatedAt: sfe.CreatedAt.UnixMilli(),
|
||||
UpdatedAt: sfe.UpdatedAt.UnixMilli(),
|
||||
}
|
||||
if sfe.UrlTemplate != nil {
|
||||
frontend.URLTemplate = *sfe.UrlTemplate
|
||||
}
|
||||
if sfe.PublicName != nil {
|
||||
frontend.PublicName = *sfe.PublicName
|
||||
}
|
||||
frontends = append(frontends, frontend)
|
||||
}
|
||||
return admin.NewListFrontendsOK().WithPayload(frontends)
|
||||
}
|
@ -79,7 +79,24 @@ func (str *Store) FindFrontendsForEnvironment(envId int, tx *sqlx.Tx) ([]*Fronte
|
||||
return is, nil
|
||||
}
|
||||
|
||||
func (str *Store) FindPublicFrontends(tx *sqlx.Tx) ([]*Frontend, error) {
|
||||
rows, err := tx.Queryx("select frontends.* from frontends where environment_id is null and reserved = true")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error selecting public frontends")
|
||||
}
|
||||
var frontends []*Frontend
|
||||
for rows.Next() {
|
||||
frontend := &Frontend{}
|
||||
if err := rows.StructScan(frontend); err != nil {
|
||||
return nil, errors.Wrap(err, "error scanning frontend")
|
||||
}
|
||||
frontends = append(frontends, frontend)
|
||||
}
|
||||
return frontends, nil
|
||||
}
|
||||
|
||||
func (str *Store) DeleteFrontend(id int, tx *sqlx.Tx) error {
|
||||
|
||||
stmt, err := tx.Prepare("delete from frontends where id = $1")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error preparing frontends delete statement")
|
||||
|
1
go.mod
1
go.mod
@ -58,6 +58,7 @@ require (
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.3 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
|
4
go.sum
4
go.sum
@ -291,6 +291,8 @@ github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7
|
||||
github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo=
|
||||
github.com/jaevor/go-nanoid v1.3.0 h1:nD+iepesZS6pr3uOVf20vR9GdGgJW1HPaR46gtrxzkg=
|
||||
github.com/jaevor/go-nanoid v1.3.0/go.mod h1:SI+jFaPuddYkqkVQoNGHs81navCtH388TcrH0RqFKgY=
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.3 h1:2n9BZ0YQiXGESUSR+6FLg0WWWE80u+mIz35f0uHWcIE=
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.3/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI=
|
||||
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
|
||||
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
||||
github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
|
||||
@ -452,6 +454,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
|
||||
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
@ -512,6 +515,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
|
@ -34,6 +34,8 @@ type ClientService interface {
|
||||
|
||||
DeleteFrontend(params *DeleteFrontendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteFrontendOK, error)
|
||||
|
||||
ListFrontends(params *ListFrontendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListFrontendsOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
@ -115,6 +117,45 @@ func (a *Client) DeleteFrontend(params *DeleteFrontendParams, authInfo runtime.C
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
ListFrontends list frontends API
|
||||
*/
|
||||
func (a *Client) ListFrontends(params *ListFrontendsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListFrontendsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewListFrontendsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "listFrontends",
|
||||
Method: "GET",
|
||||
PathPattern: "/frontends",
|
||||
ProducesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ListFrontendsReader{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.(*ListFrontendsOK)
|
||||
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 listFrontends: API contract not enforced by server. Client expected to get an error, but got: %T", result)
|
||||
panic(msg)
|
||||
}
|
||||
|
||||
// SetTransport changes the transport on the client
|
||||
func (a *Client) SetTransport(transport runtime.ClientTransport) {
|
||||
a.transport = transport
|
||||
|
128
rest_client_zrok/admin/list_frontends_parameters.go
Normal file
128
rest_client_zrok/admin/list_frontends_parameters.go
Normal file
@ -0,0 +1,128 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewListFrontendsParams creates a new ListFrontendsParams 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 NewListFrontendsParams() *ListFrontendsParams {
|
||||
return &ListFrontendsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListFrontendsParamsWithTimeout creates a new ListFrontendsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewListFrontendsParamsWithTimeout(timeout time.Duration) *ListFrontendsParams {
|
||||
return &ListFrontendsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListFrontendsParamsWithContext creates a new ListFrontendsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewListFrontendsParamsWithContext(ctx context.Context) *ListFrontendsParams {
|
||||
return &ListFrontendsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewListFrontendsParamsWithHTTPClient creates a new ListFrontendsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewListFrontendsParamsWithHTTPClient(client *http.Client) *ListFrontendsParams {
|
||||
return &ListFrontendsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ListFrontendsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the list frontends operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ListFrontendsParams struct {
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the list frontends params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListFrontendsParams) WithDefaults() *ListFrontendsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the list frontends params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ListFrontendsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the list frontends params
|
||||
func (o *ListFrontendsParams) WithTimeout(timeout time.Duration) *ListFrontendsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the list frontends params
|
||||
func (o *ListFrontendsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the list frontends params
|
||||
func (o *ListFrontendsParams) WithContext(ctx context.Context) *ListFrontendsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the list frontends params
|
||||
func (o *ListFrontendsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the list frontends params
|
||||
func (o *ListFrontendsParams) WithHTTPClient(client *http.Client) *ListFrontendsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the list frontends params
|
||||
func (o *ListFrontendsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ListFrontendsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
210
rest_client_zrok/admin/list_frontends_responses.go
Normal file
210
rest_client_zrok/admin/list_frontends_responses.go
Normal file
@ -0,0 +1,210 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ListFrontendsReader is a Reader for the ListFrontends structure.
|
||||
type ListFrontendsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ListFrontendsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewListFrontendsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
case 401:
|
||||
result := NewListFrontendsUnauthorized()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
case 500:
|
||||
result := NewListFrontendsInternalServerError()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, result
|
||||
default:
|
||||
return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
|
||||
}
|
||||
}
|
||||
|
||||
// NewListFrontendsOK creates a ListFrontendsOK with default headers values
|
||||
func NewListFrontendsOK() *ListFrontendsOK {
|
||||
return &ListFrontendsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListFrontendsOK describes a response with status code 200, with default header values.
|
||||
|
||||
ok
|
||||
*/
|
||||
type ListFrontendsOK struct {
|
||||
Payload rest_model_zrok.PublicFrontendList
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list frontends o k response has a 2xx status code
|
||||
func (o *ListFrontendsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list frontends o k response has a 3xx status code
|
||||
func (o *ListFrontendsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list frontends o k response has a 4xx status code
|
||||
func (o *ListFrontendsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list frontends o k response has a 5xx status code
|
||||
func (o *ListFrontendsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list frontends o k response a status code equal to that given
|
||||
func (o *ListFrontendsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
func (o *ListFrontendsOK) Error() string {
|
||||
return fmt.Sprintf("[GET /frontends][%d] listFrontendsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListFrontendsOK) String() string {
|
||||
return fmt.Sprintf("[GET /frontends][%d] listFrontendsOK %+v", 200, o.Payload)
|
||||
}
|
||||
|
||||
func (o *ListFrontendsOK) GetPayload() rest_model_zrok.PublicFrontendList {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ListFrontendsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListFrontendsUnauthorized creates a ListFrontendsUnauthorized with default headers values
|
||||
func NewListFrontendsUnauthorized() *ListFrontendsUnauthorized {
|
||||
return &ListFrontendsUnauthorized{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListFrontendsUnauthorized describes a response with status code 401, with default header values.
|
||||
|
||||
unauthorized
|
||||
*/
|
||||
type ListFrontendsUnauthorized struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list frontends unauthorized response has a 2xx status code
|
||||
func (o *ListFrontendsUnauthorized) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list frontends unauthorized response has a 3xx status code
|
||||
func (o *ListFrontendsUnauthorized) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list frontends unauthorized response has a 4xx status code
|
||||
func (o *ListFrontendsUnauthorized) IsClientError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list frontends unauthorized response has a 5xx status code
|
||||
func (o *ListFrontendsUnauthorized) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this list frontends unauthorized response a status code equal to that given
|
||||
func (o *ListFrontendsUnauthorized) IsCode(code int) bool {
|
||||
return code == 401
|
||||
}
|
||||
|
||||
func (o *ListFrontendsUnauthorized) Error() string {
|
||||
return fmt.Sprintf("[GET /frontends][%d] listFrontendsUnauthorized ", 401)
|
||||
}
|
||||
|
||||
func (o *ListFrontendsUnauthorized) String() string {
|
||||
return fmt.Sprintf("[GET /frontends][%d] listFrontendsUnauthorized ", 401)
|
||||
}
|
||||
|
||||
func (o *ListFrontendsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewListFrontendsInternalServerError creates a ListFrontendsInternalServerError with default headers values
|
||||
func NewListFrontendsInternalServerError() *ListFrontendsInternalServerError {
|
||||
return &ListFrontendsInternalServerError{}
|
||||
}
|
||||
|
||||
/*
|
||||
ListFrontendsInternalServerError describes a response with status code 500, with default header values.
|
||||
|
||||
internal server error
|
||||
*/
|
||||
type ListFrontendsInternalServerError struct {
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this list frontends internal server error response has a 2xx status code
|
||||
func (o *ListFrontendsInternalServerError) IsSuccess() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this list frontends internal server error response has a 3xx status code
|
||||
func (o *ListFrontendsInternalServerError) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this list frontends internal server error response has a 4xx status code
|
||||
func (o *ListFrontendsInternalServerError) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this list frontends internal server error response has a 5xx status code
|
||||
func (o *ListFrontendsInternalServerError) IsServerError() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsCode returns true when this list frontends internal server error response a status code equal to that given
|
||||
func (o *ListFrontendsInternalServerError) IsCode(code int) bool {
|
||||
return code == 500
|
||||
}
|
||||
|
||||
func (o *ListFrontendsInternalServerError) Error() string {
|
||||
return fmt.Sprintf("[GET /frontends][%d] listFrontendsInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *ListFrontendsInternalServerError) String() string {
|
||||
return fmt.Sprintf("[GET /frontends][%d] listFrontendsInternalServerError ", 500)
|
||||
}
|
||||
|
||||
func (o *ListFrontendsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
return nil
|
||||
}
|
65
rest_model_zrok/public_frontend.go
Normal file
65
rest_model_zrok/public_frontend.go
Normal file
@ -0,0 +1,65 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
// PublicFrontend public frontend
|
||||
//
|
||||
// swagger:model publicFrontend
|
||||
type PublicFrontend struct {
|
||||
|
||||
// created at
|
||||
CreatedAt int64 `json:"created_at,omitempty"`
|
||||
|
||||
// public name
|
||||
PublicName string `json:"public_name,omitempty"`
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
|
||||
// updated at
|
||||
UpdatedAt int64 `json:"updated_at,omitempty"`
|
||||
|
||||
// url template
|
||||
URLTemplate string `json:"url_template,omitempty"`
|
||||
|
||||
// z Id
|
||||
ZID string `json:"zId,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this public frontend
|
||||
func (m *PublicFrontend) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this public frontend based on context it is used
|
||||
func (m *PublicFrontend) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PublicFrontend) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PublicFrontend) UnmarshalBinary(b []byte) error {
|
||||
var res PublicFrontend
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
73
rest_model_zrok/public_frontend_list.go
Normal file
73
rest_model_zrok/public_frontend_list.go
Normal file
@ -0,0 +1,73 @@
|
||||
// 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"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// PublicFrontendList public frontend list
|
||||
//
|
||||
// swagger:model publicFrontendList
|
||||
type PublicFrontendList []*PublicFrontend
|
||||
|
||||
// Validate validates this public frontend list
|
||||
func (m PublicFrontendList) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
if swag.IsZero(m[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m[i] != nil {
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this public frontend list based on the context it is used
|
||||
func (m PublicFrontendList) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
for i := 0; i < len(m); i++ {
|
||||
|
||||
if m[i] != nil {
|
||||
if err := m[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
@ -219,6 +219,33 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/frontends": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "listFrontends",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "ok",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/publicFrontendList"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/invite": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@ -716,6 +743,35 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"publicFrontend": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"public_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"url_template": {
|
||||
"type": "string"
|
||||
},
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"publicFrontendList": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/publicFrontend"
|
||||
}
|
||||
},
|
||||
"registerRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -1109,6 +1165,33 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"/frontends": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"admin"
|
||||
],
|
||||
"operationId": "listFrontends",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "ok",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/publicFrontendList"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"description": "internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/invite": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@ -1606,6 +1689,35 @@ func init() {
|
||||
}
|
||||
}
|
||||
},
|
||||
"publicFrontend": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"public_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"token": {
|
||||
"type": "string"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "integer"
|
||||
},
|
||||
"url_template": {
|
||||
"type": "string"
|
||||
},
|
||||
"zId": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"publicFrontendList": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/publicFrontend"
|
||||
}
|
||||
},
|
||||
"registerRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
71
rest_server_zrok/operations/admin/list_frontends.go
Normal file
71
rest_server_zrok/operations/admin/list_frontends.go
Normal file
@ -0,0 +1,71 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ListFrontendsHandlerFunc turns a function with the right signature into a list frontends handler
|
||||
type ListFrontendsHandlerFunc func(ListFrontendsParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn ListFrontendsHandlerFunc) Handle(params ListFrontendsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// ListFrontendsHandler interface for that can handle valid list frontends params
|
||||
type ListFrontendsHandler interface {
|
||||
Handle(ListFrontendsParams, *rest_model_zrok.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewListFrontends creates a new http.Handler for the list frontends operation
|
||||
func NewListFrontends(ctx *middleware.Context, handler ListFrontendsHandler) *ListFrontends {
|
||||
return &ListFrontends{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
ListFrontends swagger:route GET /frontends admin listFrontends
|
||||
|
||||
ListFrontends list frontends API
|
||||
*/
|
||||
type ListFrontends struct {
|
||||
Context *middleware.Context
|
||||
Handler ListFrontendsHandler
|
||||
}
|
||||
|
||||
func (o *ListFrontends) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewListFrontendsParams()
|
||||
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)
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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/middleware"
|
||||
)
|
||||
|
||||
// NewListFrontendsParams creates a new ListFrontendsParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewListFrontendsParams() ListFrontendsParams {
|
||||
|
||||
return ListFrontendsParams{}
|
||||
}
|
||||
|
||||
// ListFrontendsParams contains all the bound params for the list frontends operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters listFrontends
|
||||
type ListFrontendsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
}
|
||||
|
||||
// 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 NewListFrontendsParams() beforehand.
|
||||
func (o *ListFrontendsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
112
rest_server_zrok/operations/admin/list_frontends_responses.go
Normal file
112
rest_server_zrok/operations/admin/list_frontends_responses.go
Normal file
@ -0,0 +1,112 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
|
||||
"github.com/openziti-test-kitchen/zrok/rest_model_zrok"
|
||||
)
|
||||
|
||||
// ListFrontendsOKCode is the HTTP code returned for type ListFrontendsOK
|
||||
const ListFrontendsOKCode int = 200
|
||||
|
||||
/*
|
||||
ListFrontendsOK ok
|
||||
|
||||
swagger:response listFrontendsOK
|
||||
*/
|
||||
type ListFrontendsOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload rest_model_zrok.PublicFrontendList `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListFrontendsOK creates ListFrontendsOK with default headers values
|
||||
func NewListFrontendsOK() *ListFrontendsOK {
|
||||
|
||||
return &ListFrontendsOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the list frontends o k response
|
||||
func (o *ListFrontendsOK) WithPayload(payload rest_model_zrok.PublicFrontendList) *ListFrontendsOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list frontends o k response
|
||||
func (o *ListFrontendsOK) SetPayload(payload rest_model_zrok.PublicFrontendList) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListFrontendsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if payload == nil {
|
||||
// return empty array
|
||||
payload = rest_model_zrok.PublicFrontendList{}
|
||||
}
|
||||
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
|
||||
// ListFrontendsUnauthorizedCode is the HTTP code returned for type ListFrontendsUnauthorized
|
||||
const ListFrontendsUnauthorizedCode int = 401
|
||||
|
||||
/*
|
||||
ListFrontendsUnauthorized unauthorized
|
||||
|
||||
swagger:response listFrontendsUnauthorized
|
||||
*/
|
||||
type ListFrontendsUnauthorized struct {
|
||||
}
|
||||
|
||||
// NewListFrontendsUnauthorized creates ListFrontendsUnauthorized with default headers values
|
||||
func NewListFrontendsUnauthorized() *ListFrontendsUnauthorized {
|
||||
|
||||
return &ListFrontendsUnauthorized{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListFrontendsUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(401)
|
||||
}
|
||||
|
||||
// ListFrontendsInternalServerErrorCode is the HTTP code returned for type ListFrontendsInternalServerError
|
||||
const ListFrontendsInternalServerErrorCode int = 500
|
||||
|
||||
/*
|
||||
ListFrontendsInternalServerError internal server error
|
||||
|
||||
swagger:response listFrontendsInternalServerError
|
||||
*/
|
||||
type ListFrontendsInternalServerError struct {
|
||||
}
|
||||
|
||||
// NewListFrontendsInternalServerError creates ListFrontendsInternalServerError with default headers values
|
||||
func NewListFrontendsInternalServerError() *ListFrontendsInternalServerError {
|
||||
|
||||
return &ListFrontendsInternalServerError{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *ListFrontendsInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(500)
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package admin
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// ListFrontendsURL generates an URL for the list frontends operation
|
||||
type ListFrontendsURL 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 *ListFrontendsURL) WithBasePath(bp string) *ListFrontendsURL {
|
||||
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 *ListFrontendsURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *ListFrontendsURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/frontends"
|
||||
|
||||
_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 *ListFrontendsURL) 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 *ListFrontendsURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *ListFrontendsURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on ListFrontendsURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on ListFrontendsURL")
|
||||
}
|
||||
|
||||
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 *ListFrontendsURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
@ -70,6 +70,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
|
||||
AccountInviteHandler: account.InviteHandlerFunc(func(params account.InviteParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.Invite has not yet been implemented")
|
||||
}),
|
||||
AdminListFrontendsHandler: admin.ListFrontendsHandlerFunc(func(params admin.ListFrontendsParams, principal *rest_model_zrok.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation admin.ListFrontends has not yet been implemented")
|
||||
}),
|
||||
AccountLoginHandler: account.LoginHandlerFunc(func(params account.LoginParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.Login has not yet been implemented")
|
||||
}),
|
||||
@ -158,6 +161,8 @@ type ZrokAPI struct {
|
||||
ServiceGetServiceHandler service.GetServiceHandler
|
||||
// AccountInviteHandler sets the operation handler for the invite operation
|
||||
AccountInviteHandler account.InviteHandler
|
||||
// AdminListFrontendsHandler sets the operation handler for the list frontends operation
|
||||
AdminListFrontendsHandler admin.ListFrontendsHandler
|
||||
// AccountLoginHandler sets the operation handler for the login operation
|
||||
AccountLoginHandler account.LoginHandler
|
||||
// MetadataOverviewHandler sets the operation handler for the overview operation
|
||||
@ -276,6 +281,9 @@ func (o *ZrokAPI) Validate() error {
|
||||
if o.AccountInviteHandler == nil {
|
||||
unregistered = append(unregistered, "account.InviteHandler")
|
||||
}
|
||||
if o.AdminListFrontendsHandler == nil {
|
||||
unregistered = append(unregistered, "admin.ListFrontendsHandler")
|
||||
}
|
||||
if o.AccountLoginHandler == nil {
|
||||
unregistered = append(unregistered, "account.LoginHandler")
|
||||
}
|
||||
@ -427,6 +435,10 @@ func (o *ZrokAPI) initHandlerCache() {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/invite"] = account.NewInvite(o.context, o.AccountInviteHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/frontends"] = admin.NewListFrontends(o.context, o.AdminListFrontendsHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
|
@ -138,6 +138,22 @@ paths:
|
||||
500:
|
||||
description: internal server error
|
||||
|
||||
/frontends:
|
||||
get:
|
||||
tags:
|
||||
- admin
|
||||
security:
|
||||
- key: []
|
||||
operationId: listFrontends
|
||||
responses:
|
||||
200:
|
||||
description: ok
|
||||
schema:
|
||||
$ref: "#/definitions/publicFrontendList"
|
||||
401:
|
||||
description: unauthorized
|
||||
500:
|
||||
description: internal server error
|
||||
#
|
||||
# environment
|
||||
#
|
||||
@ -471,6 +487,27 @@ definitions:
|
||||
admin:
|
||||
type: boolean
|
||||
|
||||
publicFrontend:
|
||||
type: object
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
zId:
|
||||
type: string
|
||||
url_template:
|
||||
type: string
|
||||
public_name:
|
||||
type: string
|
||||
created_at:
|
||||
type: integer
|
||||
updated_at:
|
||||
type: integer
|
||||
|
||||
publicFrontendList:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/publicFrontend"
|
||||
|
||||
registerRequest:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -32,6 +32,12 @@ export function deleteFrontend(options) {
|
||||
return gateway.request(deleteFrontendOperation, parameters)
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
export function listFrontends() {
|
||||
return gateway.request(listFrontendsOperation)
|
||||
}
|
||||
|
||||
const createFrontendOperation = {
|
||||
path: '/frontend',
|
||||
contentTypes: ['application/zrok.v1+json'],
|
||||
@ -53,3 +59,13 @@ const deleteFrontendOperation = {
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const listFrontendsOperation = {
|
||||
path: '/frontends',
|
||||
method: 'get',
|
||||
security: [
|
||||
{
|
||||
id: 'key'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -116,6 +116,18 @@
|
||||
* @property {boolean} admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef publicFrontend
|
||||
* @memberof module:types
|
||||
*
|
||||
* @property {string} token
|
||||
* @property {string} zId
|
||||
* @property {string} url_template
|
||||
* @property {string} public_name
|
||||
* @property {number} created_at
|
||||
* @property {number} updated_at
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef registerRequest
|
||||
* @memberof module:types
|
||||
|
Loading…
Reference in New Issue
Block a user