components

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Defaults is the same set of components that is installed in
	// the project main.go and can be used by custom builds to stay in sync
	// with the latest additions.
	Defaults = []transportd.NewComponent{
		Metrics,
		AccessLog,
		ASAPValidate,
		Timeout,
		Hedging,
		Retry,
		RetryAfter,
		ASAPToken,
		RequestValidation,
		ResponseValidation,
		Strip,
		RequestHeader,
		ResponseHeader,
		BasicAuth,
		ValidateHeaders,
	}
)

Functions

func ASAPToken

func ASAPToken(_ context.Context, _ string, _ string, _ string) (interface{}, error)

ASAPToken satisfies the NewComponent signature.

func ASAPValidate

func ASAPValidate(_ context.Context, _ string, _ string, _ string) (interface{}, error)

ASAPValidate satisfies the NewComponent signature.

func AccessLog

func AccessLog(_ context.Context, _ string, _ string, _ string) (interface{}, error)

AccessLog satisfies the NewComponent signature.

func BasicAuth added in v0.2.0

func BasicAuth(_ context.Context, _ string, _ string, _ string) (interface{}, error)

BasicAuth satisfies the NewComponent signature.

func Hedging

func Hedging(_ context.Context, _ string, _ string, _ string) (interface{}, error)

Hedging satisfies the NewComponent signature.

func Metrics

func Metrics(_ context.Context, backend string, path string, _ string) (interface{}, error)

Metrics satisfies the NewComponent signature.

func RequestHeader added in v0.6.0

func RequestHeader(_ context.Context, _ string, _ string, _ string) (interface{}, error)

RequestHeader satisfies the NewComponent signature.

func RequestValidation

func RequestValidation(_ context.Context, _ string, _ string, _ string) (interface{}, error)

RequestValidation satisfies the NewComponent signature.

func ResponseHeader added in v0.6.0

func ResponseHeader(_ context.Context, a string, b string, c string) (interface{}, error)

ResponseHeader satisfies the NewComponent signature.

func ResponseValidation

func ResponseValidation(_ context.Context, _ string, _ string, _ string) (interface{}, error)

ResponseValidation satisfies the NewComponent signature.

func Retry

func Retry(_ context.Context, _ string, _ string, _ string) (interface{}, error)

Retry satisfies the NewComponent signature.

func RetryAfter added in v1.2.0

func RetryAfter(_ context.Context, _ string, _ string, _ string) (interface{}, error)

RetryAfter satisfies the NewComponent signature.

func Strip

func Strip(_ context.Context, _ string, _ string, _ string) (interface{}, error)

Strip satisfies the NewComponent signature.

func Timeout

func Timeout(_ context.Context, _ string, _ string, _ string) (interface{}, error)

Timeout satisfies the NewComponent signature.

func ValidateHeaders added in v0.4.3

func ValidateHeaders(_ context.Context, _ string, _ string, _ string) (interface{}, error)

ValidateHeaders satisfies the NewComponent signature

Types

type ASAPTokenComponent

type ASAPTokenComponent struct{}

ASAPTokenComponent is an ASAP decorator plugin.

func (*ASAPTokenComponent) New

New generates the middleware.

func (*ASAPTokenComponent) Settings

func (m *ASAPTokenComponent) Settings() *ASAPTokenConfig

Settings generates a config populated with defaults.

type ASAPTokenConfig

type ASAPTokenConfig struct {
	PrivateKey string        `description:"RSA private key to use when signing tokens."`
	KID        string        `description:"JWT kid value to include in tokens."`
	TTL        time.Duration `description:"Lifetime of a token."`
	Issuer     string        `description:"JWT issuer value to include in tokens."`
	Audiences  []string      `description:"JWT audience values to include in tokens."`
}

ASAPTokenConfig is used to configure ASAP token generation.

func (*ASAPTokenConfig) Name

func (c *ASAPTokenConfig) Name() string

Name of the config root.

type ASAPValidateComponent

type ASAPValidateComponent struct{}

ASAPValidateComponent is an ASAP validation plugin.

func (*ASAPValidateComponent) New

New generates the middleware.

func (*ASAPValidateComponent) Settings

Settings generates a config populated with defaults.

type ASAPValidateConfig

type ASAPValidateConfig struct {
	AllowedIssuers  []string `description:"Acceptable issuer strings."`
	AllowedAudience string   `description:"Acceptable audience string."`
	KeyURLs         []string `description:"Public key download URLs."`
}

ASAPValidateConfig is used to configure ASAP validation.

func (*ASAPValidateConfig) Name

func (m *ASAPValidateConfig) Name() string

Name of the config root.

type AccessLogComponent

type AccessLogComponent struct{}

AccessLogComponent is a logging plugin.

func (*AccessLogComponent) New

New generates the middleware.

func (*AccessLogComponent) Settings

func (m *AccessLogComponent) Settings() *AccessLogConfig

Settings generates a config populated with defaults.

type AccessLogConfig

type AccessLogConfig struct{}

AccessLogConfig modifies the behavior of the access logs.

func (*AccessLogConfig) Name

func (*AccessLogConfig) Name() string

Name of the config root.

type BasicAuthComponent added in v0.2.0

type BasicAuthComponent struct{}

BasicAuthComponent is an HTTP basic auth decorator plugin.

func (*BasicAuthComponent) New added in v0.2.0

New generates the middleware.

func (*BasicAuthComponent) Settings added in v0.2.0

func (m *BasicAuthComponent) Settings() *BasicAuthConfig

Settings generates a config populated with defaults.

type BasicAuthConfig added in v0.2.0

type BasicAuthConfig struct {
	Username string `description:"Username to use in HTTP basic authentication."`
	Password string `description:"Password to use in HTTP basic authentication."`
}

BasicAuthConfig is used to configure HTTP basic authentication.

func (*BasicAuthConfig) Name added in v0.2.0

func (c *BasicAuthConfig) Name() string

Name of the config root.

type HedgingComponent

type HedgingComponent struct{}

HedgingComponent implements the settings.Component interface.

func (*HedgingComponent) New

New generates the middleware.

func (*HedgingComponent) Settings

func (*HedgingComponent) Settings() *HedgingConfig

Settings generates a config populated with defaults.

type HedgingConfig

type HedgingConfig struct {
	Interval time.Duration `description:"Duration after which to open a new request."`
}

HedgingConfig adds automated retries during times of excess latency.

func (*HedgingConfig) Name

func (*HedgingConfig) Name() string

Name of the config root.

type MetricsComponent

type MetricsComponent struct {
	Backend string
	Path    string
}

MetricsComponent implements the settings.Component interface.

func (*MetricsComponent) New

New generates the middleware.

func (*MetricsComponent) Settings

func (*MetricsComponent) Settings() *MetricsConfig

Settings generates a config populated with defaults.

type MetricsConfig

type MetricsConfig struct {
	Timing            string `description:"Name of overall timing metric."`
	DNS               string `description:"Name of DNS timing metric."`
	TCP               string `description:"Name of TCP timing metric."`
	ConnectionIdle    string `description:"Name of idle timing metric."`
	TLS               string `description:"Name of TLS timing metric."`
	WroteHeaders      string `description:"Name of time to write headers metric."`
	FirstResponseByte string `description:"Name of time to first resposne byte metrics."`
	BytesReceived     string `description:"Name of bytes received metric."`
	BytesSent         string `description:"Name of bytes sent metric."`
	BytesTotal        string `description:"Name of bytes sent and received metric."`
	PutIdle           string `description:"Name of idle connection return count metric."`
	BackendTag        string `description:"Name of the tag containing the backend reference."`
	PathTag           string `description:"Name of the tag containing the path referecne."`
}

MetricsConfig contains settings for request metrics emissions.

func (*MetricsConfig) Name

func (*MetricsConfig) Name() string

Name of the config root.

type RequestHeaderComponent added in v0.6.0

type RequestHeaderComponent struct{}

RequestHeaderComponent implements the settings.Component interface.

func (*RequestHeaderComponent) New added in v0.6.0

New generates the middleware.

func (*RequestHeaderComponent) Settings added in v0.6.0

Settings generates a config populated with defaults.

type RequestHeaderConfig added in v0.6.0

type RequestHeaderConfig struct {
	Headers map[string][]string `description:"Map of headers to inject into requests."`
}

RequestHeaderConfig configures automated header injection.

func (*RequestHeaderConfig) Name added in v0.6.0

func (*RequestHeaderConfig) Name() string

Name of the config root.

type RequestValidationComponent

type RequestValidationComponent struct{}

RequestValidationComponent enables validation of requests against the OpenAPI specification.

func (*RequestValidationComponent) New

New generates the middleware.

func (*RequestValidationComponent) Settings

Settings generates a config with all defaults set.

type RequestValidationConfig

type RequestValidationConfig struct{}

RequestValidationConfig is a placeholder for future validation options.

func (*RequestValidationConfig) Name

Name of the config root.

type ResponseHeaderComponent added in v0.6.0

type ResponseHeaderComponent struct{}

ResponseHeaderComponent implements the settings.Component interface.

func (*ResponseHeaderComponent) New added in v0.6.0

New generates the middleware.

func (*ResponseHeaderComponent) Settings added in v0.6.0

Settings generates a config populated with defaults.

type ResponseHeaderConfig added in v0.6.0

type ResponseHeaderConfig struct {
	Headers map[string][]string `description:"Map of headers to inject into responses."`
}

ResponseHeaderConfig configures automated header injection.

func (*ResponseHeaderConfig) Name added in v0.6.0

func (*ResponseHeaderConfig) Name() string

Name of the config root.

type ResponseValidationComponent

type ResponseValidationComponent struct{}

ResponseValidationComponent enables validation of requests against the OpenAPI specification.

func (*ResponseValidationComponent) New

New generates the middleware.

func (*ResponseValidationComponent) Settings

Settings generates a config with all defaults set.

type ResponseValidationConfig

type ResponseValidationConfig struct{}

ResponseValidationConfig is a placeholder for future validation options.

func (*ResponseValidationConfig) Name

Name of the config root.

type RetryAfterComponent added in v1.2.0

type RetryAfterComponent struct{}

RetryAfterComponent implements the settings.Component interface.

func (*RetryAfterComponent) New added in v1.2.0

New generates the middleware.

func (*RetryAfterComponent) Settings added in v1.2.0

Settings generates a config populated with defaults.

type RetryAfterConfig added in v1.2.0

type RetryAfterConfig struct {
}

RetryAfterConfig enables automated retries for status code 429 with Retry-After header honoring.

func (*RetryAfterConfig) Name added in v1.2.0

func (*RetryAfterConfig) Name() string

Name of the configuration root.

type RetryComponent

type RetryComponent struct{}

RetryComponent implements the settings.Component interface.

func (*RetryComponent) New

New generates the middleware.

func (*RetryComponent) Settings

func (*RetryComponent) Settings() *RetryConfig

Settings generates a config populated with defaults.

type RetryConfig

type RetryConfig struct {
	Codes   []int         `description:"HTTP status codes that trigger a retry."`
	Limit   int           `description:"Maximum retry attempts."`
	Backoff time.Duration `description:"Time to wait between requests."`
}

RetryConfig enables automated retries for status codes.

func (*RetryConfig) Name

func (*RetryConfig) Name() string

Name of the configuration root.

type StripComponent

type StripComponent struct{}

StripComponent enabled modification of the URL before redirect.

func (*StripComponent) New

New generates the middleware.

func (*StripComponent) Settings

func (*StripComponent) Settings() *StripConfig

Settings generates a config with all default values set.

type StripConfig

type StripConfig struct {
	Count int `description:"Number of URL segments to remove from the beginning of the path before redirect."`
}

StripConfig contains settings for modifying the URL.

func (*StripConfig) Name

func (*StripConfig) Name() string

Name of the config root.

type TimeoutComponent

type TimeoutComponent struct{}

TimeoutComponent implements the settings.Component interface.

func (*TimeoutComponent) New

New generates the middleware.

func (*TimeoutComponent) Settings

func (*TimeoutComponent) Settings() *TimeoutConfig

Settings generates a config populated with defaults.

type TimeoutConfig

type TimeoutConfig struct {
	After time.Duration `description:"Duration after which the request is canceled."`
}

TimeoutConfig adjusts the timeout value for requests.

func (*TimeoutConfig) Name

func (*TimeoutConfig) Name() string

Name of the configuration root.

type ValidateHeaderConfig added in v0.4.3

type ValidateHeaderConfig struct {
	Allowed map[string][]string `description:"Map of headers to validate and the allowed values for those headers."`
	Split   map[string]string   `description:"Map of delimiters to split on given headers to validate"`
}

ValidateHeaderConfig is used to validate a map of headers and their allowed values against an incoming requests headers

func (*ValidateHeaderConfig) Name added in v0.4.3

func (*ValidateHeaderConfig) Name() string

Name of the config root

type ValidateHeaderConfigComponent added in v0.4.3

type ValidateHeaderConfigComponent struct{}

ValidateHeaderConfigComponent is a plugin

func (*ValidateHeaderConfigComponent) New added in v0.4.3

New generates the middleware.

func (*ValidateHeaderConfigComponent) Settings added in v0.4.3

Settings generates a config populated with defaults.

Jump to

Keyboard shortcuts

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