web

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Code generated by api-generator DO NOT EDIT.

Code generated by api-generator DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHandler

type APIHandler[A any, R any, S any] struct {
	// contains filtered or unexported fields
}

APIHandler represents a set of objects and functions that are needed to respond to an incoming request

func NewAPIHandler

func NewAPIHandler[A any, R any, S any](authorization tokenauth.Handler,
	conversionFunc func(*tokenauth.Claims, *R) (*S, error), messageDataType logutils.MessageDataType) APIHandler[A, R, S]

NewAPIHandler creates a new APIHandler object

func (*APIHandler[A, R, S]) HandleRequest

func (h *APIHandler[A, R, S]) HandleRequest(paths map[string]*openapi3.PathItem, logger *logs.Logger) http.HandlerFunc

HandleRequest responds to an incoming request by logging it, performing authorization checks, and calling the registered handler function

func (*APIHandler[A, R, S]) SetCoreHandler

func (h *APIHandler[A, R, S]) SetCoreHandler(coreFunc interface{}, method string, tag string, ref string) error

SetCoreHandler sets the correct function field in handler by the function prototype of coreFunc

type APIsHandler

type APIsHandler[T common.Storage] struct {
	// contains filtered or unexported fields
}

APIsHandler handles the rest APIs implementation

func NewAPIsHandler

func NewAPIsHandler[T common.Storage](app *common.Application[T]) APIsHandler[T]

NewAPIsHandler creates new API handler instance

type Adapter

type Adapter[T common.Storage] struct {
	Auth *Auth

	Paths map[string]*openapi3.PathItem

	Logger *logs.Logger

	// registers auto-generated API handlers
	RegisterGeneratedHandlerFunc func(*mux.Router, string, string, string, string, string, interface{}, interface{}, interface{}) error
	// registers any manually defined API handlers
	RegisterManualHandlerFunc func(*mux.Router) error
	// registers additional auth handlers used by the service and not defined in the SDK
	AuthHandlerGetter func(string, interface{}) (tokenauth.Handler, error)
	// registers additional core handlers used by the service and not defined in the SDK
	CoreHandlerGetter func(string, string) (interface{}, error)
	// registers additional conversion functions used by the service and not defined in the SDK
	ConversionFuncGetter func(interface{}) (interface{}, error)
	// contains filtered or unexported fields
}

Adapter entity

func NewWebAdapter

func NewWebAdapter[T common.Storage](port string, serviceID string, app *common.Application[T], config AdapterConfig,
	serviceRegManager *auth.ServiceRegManager, logger *logs.Logger) Adapter[T]

NewWebAdapter creates new WebAdapter instance

func (*Adapter[T]) Start

func (a *Adapter[T]) Start()

Start starts the module

type AdapterConfig

type AdapterConfig struct {
	// server URLs
	BaseServerURL string
	ProdServerURL string
	TestServerURL string
	DevServerURL  string

	// API docs path
	DocsYAMLPath string

	// auth policy paths
	ClientAuthPermissionPolicyPath string
	ClientAuthScopePolicyPath      string
	AdminAuthPermissionPolicyPath  string
	BBsAuthPermissionPolicyPath    string
	TPSAuthPermissionPolicyPath    string
	SystemAuthPermissionPolicyPath string
}

AdapterConfig is an object used to configure an Adapter

type Auth

type Auth struct {
	Client tokenauth.Handlers
	Admin  tokenauth.Handlers
	BBs    tokenauth.Handlers
	TPS    tokenauth.Handlers
	System tokenauth.Handlers
}

Auth handler

func NewAuth

func NewAuth(serviceRegManager *auth.ServiceRegManager, clientAuthPermissionPolicyPath string, clientAuthScopePolicyPath string,
	adminAuthPermissionPolicyPath string, bbsAuthPermissionPolicyPath string, tpsAuthPermissionPolicyPath string, systemAuthPermissionPolicyPath string) (*Auth, error)

NewAuth creates new auth handler

Jump to

Keyboard shortcuts

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