types

package
v0.0.0-...-741517b Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Arch string

Platform architecture the gateway is running on

Functions

func Retry

func Retry(r routine, label string, attempts int, interval time.Duration) error

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

	// URL for alternate function logs provider.
	LogsProviderURL *url.URL

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

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

	// The name of the NATS Streaming cluster. Required for async mode.
	NATSClusterName *string

	// NATSChannel is the name of the NATS Streaming channel used for asynchronous function invocations.
	NATSChannel *string

	// Host to connect to Prometheus.
	PrometheusHost string

	// Port to connect to Prometheus.
	PrometheusPort int

	// 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 with a default value of 1024, can be used for tuning HTTP proxy performance
	MaxIdleConns int

	// MaxIdleConnsPerHost with a default value of 1024, can be used for tuning HTTP proxy performance
	MaxIdleConnsPerHost int

	// AuthProxyURL specifies URL for an authenticating proxy, disabled when blank, enabled when valid URL i.e. http://basic-auth.openfaas:8080/validate
	AuthProxyURL string

	// AuthProxyPassBody pass body to validation proxy
	AuthProxyPassBody bool

	// Namespace for endpoints
	Namespace string
}

GatewayConfig provides config for the API Gateway server process

func (*GatewayConfig) UseExternalProvider

func (g *GatewayConfig) UseExternalProvider() bool

UseExternalProvider is now required for all providers

func (*GatewayConfig) UseNATS

func (g *GatewayConfig) UseNATS() bool

UseNATS Use NATSor not

type GatewayInfo

type GatewayInfo struct {
	Provider *providerTypes.ProviderInfo `json:"provider"`
	Version  *providerTypes.VersionInfo  `json:"version"`
	Arch     string                      `json:"arch"`
}

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 invokes a function
	Proxy http.HandlerFunc

	// DeployFunction deploys a new function that isn't already deployed
	DeployFunction http.HandlerFunc

	// DeleteFunction deletes a function that is already deployed
	DeleteFunction http.HandlerFunc

	// ListFunctions lists all deployed functions in a namespace
	ListFunctions http.HandlerFunc

	// Alert handles alerts triggered from AlertManager
	Alert http.HandlerFunc

	// UpdateFunction updates an existing function
	UpdateFunction http.HandlerFunc

	// FunctionStatus returns the status of an already deployed function
	FunctionStatus http.HandlerFunc

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

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

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

	// SecretHandler enables secrets to be managed
	SecretHandler http.HandlerFunc

	// LogProxyHandler enables streaming of logs for functions
	LogProxyHandler http.HandlerFunc

	// NamespaceListerHandler lists namespaces
	NamespaceListerHandler http.HandlerFunc

	NamespaceMutatorHandler 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 ReadConfig

type ReadConfig struct {
}

ReadConfig constitutes config from env variables

func (ReadConfig) Read

func (ReadConfig) Read(hasEnv HasEnv) (*GatewayConfig, error)

Read fetches gateway server configuration from environmental variables

Jump to

Keyboard shortcuts

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