Documentation ¶
Overview ¶
Package auth provides utilities to create an Alloy component from OpenTelemetry Collector authentication extensions.
Other OpenTelemetry Collector extensions are better served as generic Alloy components rather than being placed in the otelcol namespace.
Index ¶
Constants ¶
const ( ClientAuthSupported AuthFeature = 1 << iota ServerAuthSupported AuthFeature = 1 << iota ClientAndServerAuthSupported AuthFeature = ClientAuthSupported | ServerAuthSupported Server ExtensionType = "server" Client ExtensionType = "client" )
Variables ¶
var ( ErrNotServerExtension = errors.New("component does not support server authentication") ErrNotClientExtension = errors.New("component does not support client authentication") )
Functions ¶
func HasAuthFeature ¶ added in v1.6.0
func HasAuthFeature(flag AuthFeature, feature AuthFeature) bool
func NormalizeType ¶ added in v1.1.1
func ValidateAuthFeatures ¶ added in v1.6.0
func ValidateAuthFeatures(f AuthFeature) bool
ValidateAuthFeatures makes sure a valid auth feature was returned by a
Types ¶
type Arguments ¶
type Arguments interface { component.Arguments // AuthFeature returns the type of auth that a opentelemetry collector plugin supports // client auth, server auth or both. AuthFeatures() AuthFeature // ConvertClient converts the Arguments into an OpenTelemetry Collector // client authentication extension configuration. If the plugin does // not support server authentication it should return nil, nil ConvertClient() (otelcomponent.Config, error) // ConvetServer converts the Arguments into an OpenTelemetry Collector // server authentication extension configuration. If the plugin does // not support server authentication it should return nil, nil ConvertServer() (otelcomponent.Config, error) // Extensions returns the set of extensions that the configured component is // allowed to use. Extensions() map[otelcomponent.ID]otelextension.Extension // Exporters returns the set of exporters that are exposed to the configured // component. Exporters() map[pipeline.Signal]map[otelcomponent.ID]otelcomponent.Component // DebugMetricsConfig returns the configuration for debug metrics DebugMetricsConfig() otelcolCfg.DebugMetricsArguments }
Arguments is an extension of component.Arguments which contains necessary settings for OpenTelemetry Collector authentication extensions.
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is an Alloy component shim which manages an OpenTelemetry Collector authentication extension.
func New ¶
New creates a new Alloy component which encapsulates an OpenTelemetry Collector authentication extension. args must hold a value of the argument type registered with the Alloy component.
The registered component must be registered to export the Exports type from this package, otherwise New will panic.
func (*Auth) CurrentHealth ¶
CurrentHealth implements component.HealthComponent.
func (*Auth) SetupExtension ¶ added in v1.6.0
func (a *Auth) SetupExtension(t ExtensionType, rargs Arguments, settings otelextension.Settings) (*ExtensionHandler, error)
SetupExtension sets up the extension handler object with the appropriate fields to map the alloy capsule to the underlying otel auth extension.
type AuthFeature ¶ added in v1.6.0
type AuthFeature byte
type Exports ¶
type Exports struct { // Handler is the managed component. Handler is updated any time the // extension is updated. Handler *Handler `alloy:"handler,attr"` }
Exports is a common Exports type for Alloy components which expose OpenTelemetry Collector authentication extensions.
type ExtensionHandler ¶ added in v1.6.0
type ExtensionHandler struct { ID otelcomponent.ID Extension otelextension.Extension // Set if the extension does not support the type of authentication // requested Error error }
type ExtensionType ¶ added in v1.6.0
type ExtensionType string
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler combines an extension with its ID.
func NewHandler ¶ added in v1.6.0
NewHandler creates a handler that can be exported in a capsule for otel servers to consume.
func (*Handler) AddExtension ¶ added in v1.6.0
func (h *Handler) AddExtension(et ExtensionType, eh *ExtensionHandler) error
AddExtension registers an extension type with the handler so it can be referenced by another component.
func (Handler) AlloyCapsule ¶
func (Handler) AlloyCapsule()
AlloyCapsule marks Handler as a capsule type.
func (*Handler) GetExtension ¶ added in v1.6.0
func (h *Handler) GetExtension(et ExtensionType) (*ExtensionHandler, error)
GetExtension retrieves the extension for the requested auth type, server or client.
Directories ¶
Path | Synopsis |
---|---|
Package basic provides an otelcol.auth.basic component.
|
Package basic provides an otelcol.auth.basic component. |
Package bearer provides an otelcol.auth.bearer component.
|
Package bearer provides an otelcol.auth.bearer component. |
Package headers provides an otelcol.auth.headers component.
|
Package headers provides an otelcol.auth.headers component. |