Documentation ¶
Overview ¶
Package gateway defines gateway service
Index ¶
- Constants
- func CommonURL(URLs ...string) (string, error)
- func NewCacheFs(URL string) afs.Service
- func NewFs(configURL string, fs afs.Service) afs.Service
- func ResetSingleton()
- type ApiKeyWrapper
- type Authorizer
- type AvailableRoutesError
- type ChangeDetection
- type Config
- type ExposableConfig
- type HttpError
- type Option
- func WithAuthProvider(authProvider func(config *Config, fs *embed.FS) (Authorizer, error)) Option
- func WithAuthorizer(authorizer Authorizer) Option
- func WithConfig(config *Config) Option
- func WithConfigURL(configURL string) Option
- func WithEmbedFs(embedFs *embed.FS) Option
- func WithExtensions(registry *extension.Registry) Option
- func WithMetrics(metrics *gmetric.Service) Option
- func WithRepository(repository *repository.Service) Option
- func WithStatusHandler(handler http.Handler) Option
- type Route
- type Router
- func (r *Router) DispatchStorageEvent(ctx context.Context, object storage.Object) error
- func (r *Router) Handle(writer http.ResponseWriter, request *http.Request)
- func (r *Router) HandleJob(ctx context.Context, aJob *async.Job) error
- func (r *Router) Match(method, URL string, req *http.Request) (*Route, error)
- func (r *Router) NewConfigRoute() *Route
- func (r *Router) NewContentRoute(aPath *path.Path) []*Route
- func (r *Router) NewMetricRoute(URI string) *Route
- func (r *Router) NewOpenAPIRoute(URL string, components *repository.Service, providers ...*repository.Provider) *Route
- func (r *Router) NewOptionsRoute(uri string, paths []*path.Path) *Route
- func (r *Router) NewRouteHandler(handler *router.Handler) *Route
- func (r *Router) NewStateRoute(URL string, provider *repository.Provider) *Route
- func (r *Router) NewStatusRoute() *Route
- func (r *Router) NewStructRoute(URL string, provider *repository.Provider) *Route
- func (r *Router) NewViewMetaHandler(URL string, provider *repository.Provider) *Route
- func (r *Router) NewWarmupRoute(URL string, providers ...*repository.Provider) *Route
- func (r *Router) PreCacheables(ctx context.Context, method string, uri string) ([]*view.View, error)
- type SensitiveConfig
- type Service
- func (r *Service) Close() error
- func (r *Service) LogInitTimeIfNeeded(start time.Time, writer http.ResponseWriter)
- func (r *Service) PreCachables(ctx context.Context, method string, uri string) ([]*view.View, error)
- func (r *Service) Router() (*Router, bool)
- func (r *Service) ServeHTTP(writer http.ResponseWriter, request *http.Request)
- func (r *Service) ShouldRevealMetrics() bool
- func (r *Service) WrapResponseIfNeeded(response http.ResponseWriter) http.ResponseWriter
- type Session
- func (s *Session) AddRouter(URL string, resource *router.Resource)
- func (s *Session) OnDependencyDeleted(URLs ...string)
- func (s *Session) OnDependencyUpdated(URLs ...string)
- func (s *Session) OnFileChange(URLs ...string)
- func (s *Session) OnRouterDeleted(URLs ...string)
- func (s *Session) OnRouterUpdated(URLs ...string)
- func (s *Session) UpdateFailureCounter()
- type StatusCodeError
Constants ¶
View Source
const ( RouteUnspecifiedKind = iota RouteWarmupKind RouteOpenAPIKind )
View Source
const (
PackageFile = "datly.pkg"
)
Variables ¶
This section is empty.
Functions ¶
func NewCacheFs ¶ added in v0.8.0
func ResetSingleton ¶ added in v0.2.2
func ResetSingleton()
Types ¶
type ApiKeyWrapper ¶ added in v0.8.0
type ApiKeyWrapper struct {
// contains filtered or unexported fields
}
func (*ApiKeyWrapper) Namespaces ¶ added in v0.8.0
func (a *ApiKeyWrapper) Namespaces() []string
func (*ApiKeyWrapper) URI ¶ added in v0.8.0
func (a *ApiKeyWrapper) URI() string
type Authorizer ¶ added in v0.8.0
type Authorizer interface {
Authorize(writer http.ResponseWriter, request *http.Request) bool
}
type AvailableRoutesError ¶ added in v0.8.0
func (*AvailableRoutesError) Error ¶ added in v0.8.0
func (a *AvailableRoutesError) Error() string
type ChangeDetection ¶ added in v0.8.0
type ChangeDetection struct { NumOfRetries int RetryIntervalInS int // contains filtered or unexported fields }
func (*ChangeDetection) Init ¶ added in v0.8.0
func (d *ChangeDetection) Init()
type Config ¶
type Config struct { ExposableConfig SensitiveConfig `json:",omitempty" yaml:",omitempty"` }
func NewConfigFromURL ¶
func (*Config) SyncFrequency ¶ added in v0.8.0
type ExposableConfig ¶ added in v0.8.0
type ExposableConfig struct { APIPrefix string //like /v1/api/ RouteURL string ContentURL string PluginsURL string DependencyURL string JobURL string FailedJobURL string MaxJobs int UseCacheFS bool SyncFrequencyMs int auth.Config Meta meta.Config AutoDiscovery *bool ChangeDetection *ChangeDetection DisableCors bool RevealMetric *bool CacheConnectorPrefix string }
type HttpError ¶ added in v0.8.0
func (*HttpError) StatusCode ¶ added in v0.8.0
type Option ¶ added in v0.8.0
type Option func(*options)
Option represents a service option
func WithAuthProvider ¶ added in v0.8.0
func WithAuthorizer ¶ added in v0.8.0
func WithAuthorizer(authorizer Authorizer) Option
WithAuthorizer sets an authorizer
func WithConfigURL ¶ added in v0.8.0
func WithEmbedFs ¶ added in v0.8.0
WithEmbedFs sets an embed file system
func WithExtensions ¶ added in v0.8.0
WithExtensions sets an extension registry
func WithMetrics ¶ added in v0.8.0
WithMetrics sets a metrics service
func WithRepository ¶ added in v0.8.0
func WithRepository(repository *repository.Service) Option
WithRepository sets a repository service
func WithStatusHandler ¶ added in v0.8.0
type Route ¶ added in v0.8.0
type Route struct { Path *contract.Path Kind int ApiKeys []*path.APIKey Providers []*repository.Provider NewMultiRoute func(routes []*contract.Path) *Route Handler func(ctx context.Context, response http.ResponseWriter, req *http.Request) }
func (*Route) Namespaces ¶ added in v0.8.0
type Router ¶ added in v0.8.0
func NewRouter ¶ added in v0.8.0
func NewRouter(ctx context.Context, components *repository.Service, config *Config, metrics *gmetric.Service, statusHandler http.Handler, authorizer Authorizer) (*Router, error)
NewRouter creates new router
func (*Router) DispatchStorageEvent ¶ added in v0.8.0
func (*Router) Handle ¶ added in v0.8.0
func (r *Router) Handle(writer http.ResponseWriter, request *http.Request)
func (*Router) NewConfigRoute ¶ added in v0.8.0
func (*Router) NewContentRoute ¶ added in v0.8.0
func (*Router) NewMetricRoute ¶ added in v0.8.0
func (*Router) NewOpenAPIRoute ¶ added in v0.8.0
func (r *Router) NewOpenAPIRoute(URL string, components *repository.Service, providers ...*repository.Provider) *Route
func (*Router) NewOptionsRoute ¶ added in v0.8.0
func (*Router) NewRouteHandler ¶ added in v0.8.0
func (*Router) NewStateRoute ¶ added in v0.8.0
func (r *Router) NewStateRoute(URL string, provider *repository.Provider) *Route
func (*Router) NewStatusRoute ¶ added in v0.8.0
func (*Router) NewStructRoute ¶ added in v0.8.0
func (r *Router) NewStructRoute(URL string, provider *repository.Provider) *Route
func (*Router) NewViewMetaHandler ¶ added in v0.8.0
func (r *Router) NewViewMetaHandler(URL string, provider *repository.Provider) *Route
func (*Router) NewWarmupRoute ¶ added in v0.8.0
func (r *Router) NewWarmupRoute(URL string, providers ...*repository.Provider) *Route
type SensitiveConfig ¶ added in v0.8.0
type Service ¶
type Service struct { Config *Config JWTSigner *signer.Service // contains filtered or unexported fields }
func New ¶
New creates gateway Service. It is important to call Service.Close before Service got Garbage collected.
func (*Service) LogInitTimeIfNeeded ¶ added in v0.8.0
func (r *Service) LogInitTimeIfNeeded(start time.Time, writer http.ResponseWriter)
func (*Service) PreCachables ¶ added in v0.2.11
func (*Service) ServeHTTP ¶ added in v0.8.0
func (r *Service) ServeHTTP(writer http.ResponseWriter, request *http.Request)
func (*Service) ShouldRevealMetrics ¶ added in v0.8.0
func (*Service) WrapResponseIfNeeded ¶ added in v0.8.0
func (r *Service) WrapResponseIfNeeded(response http.ResponseWriter) http.ResponseWriter
type Session ¶ added in v0.8.0
type Session struct { FailureCounter map[string]int DeletedDependencies map[string]bool UpdatedDependencies map[string]bool DeletedRouters map[string]bool UpdatedRouters map[string]bool Routers map[string]*router.Resource Dependencies map[string]*view.Resource // contains filtered or unexported fields }
func NewSession ¶ added in v0.8.0
func NewSession(config *ChangeDetection) *Session
func (*Session) OnDependencyDeleted ¶ added in v0.8.0
func (*Session) OnDependencyUpdated ¶ added in v0.8.0
func (*Session) OnFileChange ¶ added in v0.8.0
func (*Session) OnRouterDeleted ¶ added in v0.8.0
func (*Session) OnRouterUpdated ¶ added in v0.8.0
func (*Session) UpdateFailureCounter ¶ added in v0.8.0
func (s *Session) UpdateFailureCounter()
type StatusCodeError ¶ added in v0.8.0
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
apigw
Package apigw defines apigw lambda datly runtime
|
Package apigw defines apigw lambda datly runtime |
gcf
Package gcf defines Google Cloud Functions entry point
|
Package gcf defines Google Cloud Functions entry point |
gcr
Package gcr defines Google Cloud Exec entry point
|
Package gcr defines Google Cloud Exec entry point |
lambda
Package lambda defines lambda datly runtime
|
Package lambda defines lambda datly runtime |
Click to show internal directories.
Click to hide internal directories.