types

package
v0.0.0-...-47fbf8c Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Arch string

Platform architecture the gateway is running on

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

	// 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 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 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 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"`
	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 functions upstream
	Proxy http.HandlerFunc

	DeployFunction http.HandlerFunc
	DeleteFunction http.HandlerFunc
	ListFunctions  http.HandlerFunc
	Alert          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 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
}

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, error)

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