ui

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package ui takes a sysl module with attributes defined (uiFields) and serves a webserver listing the applications and endpoints It also uses gRPC UI and Redoc in order to generate an interactive page to interact with all the endpoints gRPC currently uses server reflection TODO: Support gpcui directly from proto files

Package ui takes a sysl module with attributes defined (uiFields) and serves a webserver listing the applications and endpoints It also uses GRPCUI and Redoc in order to generate an interactive page to interact with all the endpoints GRPC currently uses server reflection TODO: Support gpcui directly from swagger files

Index

Constants

View Source
const GRPC = "grpc"
View Source
const REST = "rest"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIDoc

type APIDoc struct {
	// contains filtered or unexported fields
}

APIDoc contains everything required to serve a view of a Sysl described application

type APIDocBuilder

type APIDocBuilder struct {
	// contains filtered or unexported fields
}

func MakeAPIDocBuilder

func MakeAPIDocBuilder(app *sysl.Application, log *logrus.Logger, grpcui bool) *APIDocBuilder

func (APIDocBuilder) BuildAPIDoc

func (b APIDocBuilder) BuildAPIDoc() (*APIDoc, error)

func (*APIDocBuilder) SwaggerUI

func (b *APIDocBuilder) SwaggerUI(contents []byte, basepath string) (http.Handler, error)

SwaggerUI takes the contents of a swagger file and creates a handler to display the the endpoints

type Endpoint

type Endpoint struct {
	Path     string
	Request  string
	Response string
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func MakeServer

func MakeServer(docHandlers map[string]*http.Handler, apiDocs []*APIDoc, serviceJSON []byte, log *logrus.Logger, host string) *Server

MakeServer returns a WebServer

func (*Server) Serve

func (s *Server) Serve() error

Serve starts up a webserver that documents the apps and endpoints documented in the sysl file

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP calls the http handler from the router

func (*Server) Setup

func (s *Server) Setup() error

type SyslUI

type SyslUI struct {
	Fs       afero.Fs       // Required
	Log      *logrus.Logger // Required
	Modules  []*sysl.Module // Required
	Fields   []string       // Required
	Host     string         // Required
	GRPCUI   bool
	BasePath string
}

SyslUI holds the config options passed into the command

func (*SyslUI) GenerateServer

func (s *SyslUI) GenerateServer() (*Server, error)

type WebService

type WebService struct {
	Name       string
	Attributes map[string]string
	Endpoints  []Endpoint
	Type       string
	Path       string
}

WebService is the struct which will be translated to JSON via reflection.

func BuildWebService

func BuildWebService(a *sysl.Application) (*WebService, error)

BuildWebService takes a sysl Application and returns a json-exportable representation of Sysl

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL