overview spec

This commit is contained in:
Michael Quigley 2022-08-03 14:36:40 -04:00
parent 2d94591812
commit 1632422b37
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
15 changed files with 1040 additions and 0 deletions

View File

@ -32,6 +32,8 @@ type ClientOption func(*runtime.ClientOperation)
type ClientService interface {
ListEnvironments(params *ListEnvironmentsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListEnvironmentsOK, error)
Overview(params *OverviewParams, opts ...ClientOption) (*OverviewOK, error)
Version(params *VersionParams, opts ...ClientOption) (*VersionOK, error)
SetTransport(transport runtime.ClientTransport)
@ -76,6 +78,44 @@ func (a *Client) ListEnvironments(params *ListEnvironmentsParams, authInfo runti
panic(msg)
}
/*
Overview overview API
*/
func (a *Client) Overview(params *OverviewParams, opts ...ClientOption) (*OverviewOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewOverviewParams()
}
op := &runtime.ClientOperation{
ID: "overview",
Method: "GET",
PathPattern: "/overview",
ProducesMediaTypes: []string{"application/zrok.v1+json"},
ConsumesMediaTypes: []string{"application/zrok.v1+json"},
Schemes: []string{"http"},
Params: params,
Reader: &OverviewReader{formats: a.formats},
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.(*OverviewOK)
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 overview: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
Version version API
*/

View File

@ -0,0 +1,126 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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"
)
// NewOverviewParams creates a new OverviewParams 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 NewOverviewParams() *OverviewParams {
return &OverviewParams{
timeout: cr.DefaultTimeout,
}
}
// NewOverviewParamsWithTimeout creates a new OverviewParams object
// with the ability to set a timeout on a request.
func NewOverviewParamsWithTimeout(timeout time.Duration) *OverviewParams {
return &OverviewParams{
timeout: timeout,
}
}
// NewOverviewParamsWithContext creates a new OverviewParams object
// with the ability to set a context for a request.
func NewOverviewParamsWithContext(ctx context.Context) *OverviewParams {
return &OverviewParams{
Context: ctx,
}
}
// NewOverviewParamsWithHTTPClient creates a new OverviewParams object
// with the ability to set a custom HTTPClient for a request.
func NewOverviewParamsWithHTTPClient(client *http.Client) *OverviewParams {
return &OverviewParams{
HTTPClient: client,
}
}
/* OverviewParams contains all the parameters to send to the API endpoint
for the overview operation.
Typically these are written to a http.Request.
*/
type OverviewParams struct {
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the overview params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *OverviewParams) WithDefaults() *OverviewParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the overview params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *OverviewParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the overview params
func (o *OverviewParams) WithTimeout(timeout time.Duration) *OverviewParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the overview params
func (o *OverviewParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the overview params
func (o *OverviewParams) WithContext(ctx context.Context) *OverviewParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the overview params
func (o *OverviewParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the overview params
func (o *OverviewParams) WithHTTPClient(client *http.Client) *OverviewParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the overview params
func (o *OverviewParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WriteToRequest writes these params to a swagger request
func (o *OverviewParams) 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
}

View File

@ -0,0 +1,103 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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"
)
// OverviewReader is a Reader for the Overview structure.
type OverviewReader struct {
formats strfmt.Registry
}
// ReadResponse reads a server response into the received o.
func (o *OverviewReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
switch response.Code() {
case 200:
result := NewOverviewOK()
if err := result.readResponse(response, consumer, o.formats); err != nil {
return nil, err
}
return result, nil
case 500:
result := NewOverviewInternalServerError()
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())
}
}
// NewOverviewOK creates a OverviewOK with default headers values
func NewOverviewOK() *OverviewOK {
return &OverviewOK{}
}
/* OverviewOK describes a response with status code 200, with default header values.
overview returned
*/
type OverviewOK struct {
Payload *rest_model_zrok.EnvironmentServices
}
func (o *OverviewOK) Error() string {
return fmt.Sprintf("[GET /overview][%d] overviewOK %+v", 200, o.Payload)
}
func (o *OverviewOK) GetPayload() *rest_model_zrok.EnvironmentServices {
return o.Payload
}
func (o *OverviewOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(rest_model_zrok.EnvironmentServices)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
return nil
}
// NewOverviewInternalServerError creates a OverviewInternalServerError with default headers values
func NewOverviewInternalServerError() *OverviewInternalServerError {
return &OverviewInternalServerError{}
}
/* OverviewInternalServerError describes a response with status code 500, with default header values.
internal server error
*/
type OverviewInternalServerError struct {
Payload rest_model_zrok.ErrorMessage
}
func (o *OverviewInternalServerError) Error() string {
return fmt.Sprintf("[GET /overview][%d] overviewInternalServerError %+v", 500, o.Payload)
}
func (o *OverviewInternalServerError) GetPayload() rest_model_zrok.ErrorMessage {
return o.Payload
}
func (o *OverviewInternalServerError) 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
}

View File

@ -0,0 +1,146 @@
// 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/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// EnvironmentServices environment services
//
// swagger:model environmentServices
type EnvironmentServices struct {
// environment
Environment *Environment `json:"environment,omitempty"`
// services
Services Services `json:"services,omitempty"`
}
// Validate validates this environment services
func (m *EnvironmentServices) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEnvironment(formats); err != nil {
res = append(res, err)
}
if err := m.validateServices(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EnvironmentServices) validateEnvironment(formats strfmt.Registry) error {
if swag.IsZero(m.Environment) { // not required
return nil
}
if m.Environment != nil {
if err := m.Environment.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("environment")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("environment")
}
return err
}
}
return nil
}
func (m *EnvironmentServices) validateServices(formats strfmt.Registry) error {
if swag.IsZero(m.Services) { // not required
return nil
}
if err := m.Services.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("services")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("services")
}
return err
}
return nil
}
// ContextValidate validate this environment services based on the context it is used
func (m *EnvironmentServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateEnvironment(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateServices(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *EnvironmentServices) contextValidateEnvironment(ctx context.Context, formats strfmt.Registry) error {
if m.Environment != nil {
if err := m.Environment.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("environment")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("environment")
}
return err
}
}
return nil
}
func (m *EnvironmentServices) contextValidateServices(ctx context.Context, formats strfmt.Registry) error {
if err := m.Services.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("services")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("services")
}
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *EnvironmentServices) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *EnvironmentServices) UnmarshalBinary(b []byte) error {
var res EnvironmentServices
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@ -0,0 +1,62 @@
// 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"
)
// Service service
//
// swagger:model service
type Service struct {
// active
Active bool `json:"active,omitempty"`
// created at
CreatedAt string `json:"createdAt,omitempty"`
// endpoint
Endpoint string `json:"endpoint,omitempty"`
// updated at
UpdatedAt string `json:"updatedAt,omitempty"`
// ziti service Id
ZitiServiceID string `json:"zitiServiceId,omitempty"`
}
// Validate validates this service
func (m *Service) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this service based on context it is used
func (m *Service) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Service) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Service) UnmarshalBinary(b []byte) error {
var res Service
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View 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"
)
// Services services
//
// swagger:model services
type Services []*Service
// Validate validates this services
func (m Services) 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 services based on the context it is used
func (m Services) 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
}

View File

@ -169,6 +169,28 @@ func init() {
}
}
},
"/overview": {
"get": {
"tags": [
"metadata"
],
"operationId": "overview",
"responses": {
"200": {
"description": "overview returned",
"schema": {
"$ref": "#/definitions/environmentServices"
}
},
"500": {
"description": "internal server error",
"schema": {
"$ref": "#/definitions/errorMessage"
}
}
}
}
},
"/tunnel": {
"post": {
"security": [
@ -335,6 +357,17 @@ func init() {
}
}
},
"environmentServices": {
"type": "object",
"properties": {
"environment": {
"$ref": "#/definitions/environment"
},
"services": {
"$ref": "#/definitions/services"
}
}
},
"environments": {
"type": "array",
"items": {
@ -372,6 +405,32 @@ func init() {
}
}
},
"service": {
"type": "object",
"properties": {
"active": {
"type": "boolean"
},
"createdAt": {
"type": "string"
},
"endpoint": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"zitiServiceId": {
"type": "string"
}
}
},
"services": {
"type": "array",
"items": {
"$ref": "#/definitions/service"
}
},
"tunnelRequest": {
"type": "object",
"properties": {
@ -563,6 +622,28 @@ func init() {
}
}
},
"/overview": {
"get": {
"tags": [
"metadata"
],
"operationId": "overview",
"responses": {
"200": {
"description": "overview returned",
"schema": {
"$ref": "#/definitions/environmentServices"
}
},
"500": {
"description": "internal server error",
"schema": {
"$ref": "#/definitions/errorMessage"
}
}
}
}
},
"/tunnel": {
"post": {
"security": [
@ -729,6 +810,17 @@ func init() {
}
}
},
"environmentServices": {
"type": "object",
"properties": {
"environment": {
"$ref": "#/definitions/environment"
},
"services": {
"$ref": "#/definitions/services"
}
}
},
"environments": {
"type": "array",
"items": {
@ -766,6 +858,32 @@ func init() {
}
}
},
"service": {
"type": "object",
"properties": {
"active": {
"type": "boolean"
},
"createdAt": {
"type": "string"
},
"endpoint": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"zitiServiceId": {
"type": "string"
}
}
},
"services": {
"type": "array",
"items": {
"$ref": "#/definitions/service"
}
},
"tunnelRequest": {
"type": "object",
"properties": {

View File

@ -0,0 +1,56 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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"
)
// OverviewHandlerFunc turns a function with the right signature into a overview handler
type OverviewHandlerFunc func(OverviewParams) middleware.Responder
// Handle executing the request and returning a response
func (fn OverviewHandlerFunc) Handle(params OverviewParams) middleware.Responder {
return fn(params)
}
// OverviewHandler interface for that can handle valid overview params
type OverviewHandler interface {
Handle(OverviewParams) middleware.Responder
}
// NewOverview creates a new http.Handler for the overview operation
func NewOverview(ctx *middleware.Context, handler OverviewHandler) *Overview {
return &Overview{Context: ctx, Handler: handler}
}
/* Overview swagger:route GET /overview metadata overview
Overview overview API
*/
type Overview struct {
Context *middleware.Context
Handler OverviewHandler
}
func (o *Overview) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewOverviewParams()
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) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@ -0,0 +1,46 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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"
)
// NewOverviewParams creates a new OverviewParams object
//
// There are no default values defined in the spec.
func NewOverviewParams() OverviewParams {
return OverviewParams{}
}
// OverviewParams contains all the bound params for the overview operation
// typically these are obtained from a http.Request
//
// swagger:parameters overview
type OverviewParams 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 NewOverviewParams() beforehand.
func (o *OverviewParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -0,0 +1,100 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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"
)
// OverviewOKCode is the HTTP code returned for type OverviewOK
const OverviewOKCode int = 200
/*OverviewOK overview returned
swagger:response overviewOK
*/
type OverviewOK struct {
/*
In: Body
*/
Payload *rest_model_zrok.EnvironmentServices `json:"body,omitempty"`
}
// NewOverviewOK creates OverviewOK with default headers values
func NewOverviewOK() *OverviewOK {
return &OverviewOK{}
}
// WithPayload adds the payload to the overview o k response
func (o *OverviewOK) WithPayload(payload *rest_model_zrok.EnvironmentServices) *OverviewOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the overview o k response
func (o *OverviewOK) SetPayload(payload *rest_model_zrok.EnvironmentServices) {
o.Payload = payload
}
// WriteResponse to the client
func (o *OverviewOK) 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
}
}
}
// OverviewInternalServerErrorCode is the HTTP code returned for type OverviewInternalServerError
const OverviewInternalServerErrorCode int = 500
/*OverviewInternalServerError internal server error
swagger:response overviewInternalServerError
*/
type OverviewInternalServerError struct {
/*
In: Body
*/
Payload rest_model_zrok.ErrorMessage `json:"body,omitempty"`
}
// NewOverviewInternalServerError creates OverviewInternalServerError with default headers values
func NewOverviewInternalServerError() *OverviewInternalServerError {
return &OverviewInternalServerError{}
}
// WithPayload adds the payload to the overview internal server error response
func (o *OverviewInternalServerError) WithPayload(payload rest_model_zrok.ErrorMessage) *OverviewInternalServerError {
o.Payload = payload
return o
}
// SetPayload sets the payload to the overview internal server error response
func (o *OverviewInternalServerError) SetPayload(payload rest_model_zrok.ErrorMessage) {
o.Payload = payload
}
// WriteResponse to the client
func (o *OverviewInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(500)
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -0,0 +1,87 @@
// Code generated by go-swagger; DO NOT EDIT.
package metadata
// 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"
)
// OverviewURL generates an URL for the overview operation
type OverviewURL 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 *OverviewURL) WithBasePath(bp string) *OverviewURL {
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 *OverviewURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *OverviewURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/overview"
_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 *OverviewURL) 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 *OverviewURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *OverviewURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on OverviewURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on OverviewURL")
}
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 *OverviewURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@ -59,6 +59,9 @@ func NewZrokAPI(spec *loads.Document) *ZrokAPI {
IdentityLoginHandler: identity.LoginHandlerFunc(func(params identity.LoginParams) middleware.Responder {
return middleware.NotImplemented("operation identity.Login has not yet been implemented")
}),
MetadataOverviewHandler: metadata.OverviewHandlerFunc(func(params metadata.OverviewParams) middleware.Responder {
return middleware.NotImplemented("operation metadata.Overview has not yet been implemented")
}),
TunnelTunnelHandler: tunnel.TunnelHandlerFunc(func(params tunnel.TunnelParams, principal *rest_model_zrok.Principal) middleware.Responder {
return middleware.NotImplemented("operation tunnel.Tunnel has not yet been implemented")
}),
@ -126,6 +129,8 @@ type ZrokAPI struct {
MetadataListEnvironmentsHandler metadata.ListEnvironmentsHandler
// IdentityLoginHandler sets the operation handler for the login operation
IdentityLoginHandler identity.LoginHandler
// MetadataOverviewHandler sets the operation handler for the overview operation
MetadataOverviewHandler metadata.OverviewHandler
// TunnelTunnelHandler sets the operation handler for the tunnel operation
TunnelTunnelHandler tunnel.TunnelHandler
// TunnelUntunnelHandler sets the operation handler for the untunnel operation
@ -225,6 +230,9 @@ func (o *ZrokAPI) Validate() error {
if o.IdentityLoginHandler == nil {
unregistered = append(unregistered, "identity.LoginHandler")
}
if o.MetadataOverviewHandler == nil {
unregistered = append(unregistered, "metadata.OverviewHandler")
}
if o.TunnelTunnelHandler == nil {
unregistered = append(unregistered, "tunnel.TunnelHandler")
}
@ -349,6 +357,10 @@ func (o *ZrokAPI) initHandlerCache() {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/login"] = identity.NewLogin(o.context, o.IdentityLoginHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/overview"] = metadata.NewOverview(o.context, o.MetadataOverviewHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}

View File

@ -97,6 +97,21 @@ paths:
401:
description: invalid login
/overview:
get:
tags:
- metadata
operationId: overview
responses:
200:
description: overview returned
schema:
$ref: "#/definitions/environmentServices"
500:
description: internal server error
schema:
$ref: "#/definitions/errorMessage"
/tunnel:
post:
tags:
@ -207,6 +222,14 @@ definitions:
updatedAt:
type: string
environmentServices:
type: object
properties:
environment:
$ref: "#/definitions/environment"
services:
$ref: "#/definitions/services"
errorMessage:
type: string
@ -230,6 +253,24 @@ definitions:
token:
type: string
services:
type: array
items:
$ref: "#/definitions/service"
service:
type: object
properties:
zitiServiceId:
type: string
endpoint:
type: string
active:
type: boolean
createdAt:
type: string
updatedAt:
type: string
tunnelRequest:
type: object
properties:

View File

@ -8,6 +8,12 @@ export function listEnvironments() {
return gateway.request(listEnvironmentsOperation)
}
/**
*/
export function overview() {
return gateway.request(overviewOperation)
}
/**
*/
export function version() {
@ -24,6 +30,11 @@ const listEnvironmentsOperation = {
]
}
const overviewOperation = {
path: '/overview',
method: 'get'
}
const versionOperation = {
path: '/version',
method: 'get'

View File

@ -45,6 +45,14 @@
* @property {string} updatedAt
*/
/**
* @typedef environmentServices
* @memberof module:types
*
* @property {module:types.environment} environment
* @property {module:types.services} services
*/
/**
* @typedef loginRequest
* @memberof module:types
@ -62,6 +70,17 @@
* @property {string} token
*/
/**
* @typedef service
* @memberof module:types
*
* @property {string} zitiServiceId
* @property {string} endpoint
* @property {boolean} active
* @property {string} createdAt
* @property {string} updatedAt
*/
/**
* @typedef tunnelRequest
* @memberof module:types