types

package
v0.0.0-...-350b75a Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GatewayConfig

type GatewayConfig struct {

	// HTTP timeout for reading a request from clients.
	ReadTimeout time.Duration

	// HTTP timeout for writing a response from functions.
	WriteTimeout time.Duration

	// UpstreamTimeout maximum duration of HTTP call to upstream URL
	UpstreamTimeout time.Duration

	// URL for alternate functions provider.
	FunctionsProviderURL *url.URL

	// Address of the NATS service. Required for async mode.
	NATSAddress *string

	// Port of the NATS Service. Required for async mode.
	NATSPort *int

	// Host to connect to Prometheus.
	PrometheusHost string

	// Port to connect to Prometheus.
	PrometheusPort int

	// If set to true we will access upstream functions directly rather than through the upstream provider
	DirectFunctions bool

	// If set this will be used to resolve functions directly
	DirectFunctionsSuffix string

	// If set, reads secrets from file-system for enabling basic auth.
	UseBasicAuth bool

	// SecretMountPath specifies where to read secrets from for embedded basic auth
	SecretMountPath string

	// Enable the gateway to scale any service from 0 replicas to its configured "min replicas"
	ScaleFromZero bool

	MaxIdleConns int

	MaxIdleConnsPerHost int
}

GatewayConfig provides config for the API Gateway server process

func (*GatewayConfig) UseExternalProvider

func (g *GatewayConfig) UseExternalProvider() bool

UseExternalProvider decide whether to bypass built-in Docker Swarm engine

func (*GatewayConfig) UseNATS

func (g *GatewayConfig) UseNATS() bool

UseNATS Use NATSor not

type GatewayInfo

type GatewayInfo struct {
	Provider *ProviderInfo `json:"provider"`
	Version  *VersionInfo  `json:"version"`
}

GatewayInfo provides information about the gateway and it's connected components

type HTTPClientReverseProxy

type HTTPClientReverseProxy struct {
	BaseURL *url.URL
	Client  *http.Client
	Timeout time.Duration
}

HTTPClientReverseProxy proxy to a remote BaseURL using a http.Client

func NewHTTPClientReverseProxy

func NewHTTPClientReverseProxy(baseURL *url.URL, timeout time.Duration, maxIdleConns, maxIdleConnsPerHost int) *HTTPClientReverseProxy

NewHTTPClientReverseProxy proxies to an upstream host through the use of a http.Client

type HandlerSet

type HandlerSet struct {
	Proxy          http.HandlerFunc
	DeployFunction http.HandlerFunc
	DeleteFunction http.HandlerFunc
	ListFunctions  http.HandlerFunc
	Alert          http.HandlerFunc
	RoutelessProxy http.HandlerFunc
	UpdateFunction http.HandlerFunc

	// QueryFunction - queries the metdata for a function
	QueryFunction http.HandlerFunc

	// QueuedProxy - queue work and return synchronous response
	QueuedProxy http.HandlerFunc

	// AsyncReport - report a deferred execution result
	AsyncReport http.HandlerFunc

	// ScaleFunction allows a function to be scaled
	ScaleFunction http.HandlerFunc

	// InfoHandler provides version and build info
	InfoHandler http.HandlerFunc

	// SecretHandler allows secrets to be managed
	SecretHandler http.HandlerFunc
}

HandlerSet can be initialized with handlers for binding to mux

type HasEnv

type HasEnv interface {
	Getenv(key string) string
}

HasEnv provides interface for os.Getenv

type OsEnv

type OsEnv struct {
}

OsEnv implements interface to wrap os.Getenv

func (OsEnv) Getenv

func (OsEnv) Getenv(key string) string

Getenv wraps os.Getenv

type ProviderInfo

type ProviderInfo struct {
	Name          string       `json:"provider"`
	Version       *VersionInfo `json:"version"`
	Orchestration string       `json:"orchestration"`
}

ProviderInfo provides information about the configured provider

type ReadConfig

type ReadConfig struct {
}

ReadConfig constitutes config from env variables

func (ReadConfig) Read

func (ReadConfig) Read(hasEnv HasEnv) GatewayConfig

Read fetches gateway server configuration from environmental variables

type VersionInfo

type VersionInfo struct {
	CommitMessage string `json:"commit_message,omitempty"`
	SHA           string `json:"sha"`
	Release       string `json:"release"`
}

VersionInfo provides the commit message, sha and release version number

Jump to

Keyboard shortcuts

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